]> source.dussan.org Git - aspectj.git/commitdiff
321641: test and fix: exclusion for double dollared names (eg. cglib)
authoraclement <aclement>
Tue, 10 Aug 2010 15:11:54 +0000 (15:11 +0000)
committeraclement <aclement>
Tue, 10 Aug 2010 15:11:54 +0000 (15:11 +0000)
loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java
loadtime/testsrc/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptorTest.java
loadtime/testsrc/testdata/MessageService$$EnhancerByCGLIB$$6dd4e683.java [new file with mode: 0644]

index 134de582fced9b507f6a71a35599637f094f4e81..b3a5f05beb50c1e736700fd95c53eeebaf636fce 100644 (file)
@@ -33,10 +33,10 @@ import org.aspectj.bridge.AbortException;
 import org.aspectj.bridge.Constants;
 import org.aspectj.util.LangUtil;
 import org.aspectj.weaver.Lint;
+import org.aspectj.weaver.Lint.Kind;
 import org.aspectj.weaver.ResolvedType;
 import org.aspectj.weaver.UnresolvedType;
 import org.aspectj.weaver.World;
-import org.aspectj.weaver.Lint.Kind;
 import org.aspectj.weaver.bcel.BcelWeakClassLoaderReference;
 import org.aspectj.weaver.bcel.BcelWeaver;
 import org.aspectj.weaver.bcel.BcelWorld;
@@ -731,7 +731,7 @@ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor {
                }
 
                // still try to avoid ResolvedType if we have simple patterns
-               String fastClassName = className.replace('/', '.').replace('$', '.');
+               String fastClassName = className.replace('/', '.');
                for (String excludeStartsWithString : excludeStartsWith) {
                        if (fastClassName.startsWith(excludeStartsWithString)) {
                                return false;
@@ -747,6 +747,7 @@ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor {
                                }
                        }
                }
+               fastClassName = fastClassName.replace('$', '.');
 
                if (!excludeEndsWith.isEmpty()) {
                        for (String lastPiece : excludeEndsWith) {
index 9565e8ce14ea25b6cd43b41404812301d6331331..456fde1210f1caa7160433f6dd511b115ffdcd81 100644 (file)
@@ -11,6 +11,7 @@
 package org.aspectj.weaver.loadtime;
 
 import java.io.File;
+import java.lang.ref.Reference;
 import java.lang.reflect.Field;
 import java.net.URL;
 import java.net.URLClassLoader;
@@ -23,6 +24,7 @@ import junit.framework.TestCase;
 import org.aspectj.apache.bcel.classfile.JavaClass;
 import org.aspectj.apache.bcel.util.ClassPath;
 import org.aspectj.apache.bcel.util.SyntheticRepository;
+import org.aspectj.weaver.ResolvedType;
 import org.aspectj.weaver.World;
 import org.aspectj.weaver.World.TypeMap;
 import org.aspectj.weaver.bcel.BcelWorld;
@@ -508,6 +510,10 @@ public class ClassLoaderWeavingAdaptorTest extends TestCase {
                etime = System.currentTimeMillis();
                System.out.println("Rejection " + (etime - stime) + "ms");
 
+               jc = getClassFrom("../loadtime/bin", "testdata.MessageService$$EnhancerByCGLIB$$6dd4e683");
+               byte[] bs3 = jc.getBytes();
+               boolean b = adaptor.accept("testdata.MessageService$$EnhancerByCGLIB$$6dd4e683", bs3);
+               assertFalse(b);
        }
 
        // TODO
@@ -624,19 +630,19 @@ public class ClassLoaderWeavingAdaptorTest extends TestCase {
                }
        }
 
+       @SuppressWarnings("unused")
        private void printMaps(TypeMap map) {
                printExpendableMap(map.getExpendableMap());
                printMainMap(map.getMainMap());
        }
 
-       private void printExpendableMap(Map m) {
-               for (Object o : m.keySet()) {
-                       String sig = (String) o;
+       private void printExpendableMap(Map<String, Reference<ResolvedType>> m) {
+               for (String sig : m.keySet()) {
                        System.out.println(sig + "=" + m.get(sig));
                }
        }
 
-       private void printMainMap(Map m) {
+       private void printMainMap(Map<String, ResolvedType> m) {
                for (Object o : m.keySet()) {
                        String sig = (String) o;
                        System.out.println(sig + "=" + m.get(sig));
@@ -680,7 +686,7 @@ public class ClassLoaderWeavingAdaptorTest extends TestCase {
 
        static class TestWeavingContext extends DefaultWeavingContext {
 
-               List testList = new ArrayList();
+               List<Definition> testList = new ArrayList<Definition>();
 
                public TestWeavingContext(ClassLoader loader) {
                        super(loader);
@@ -691,7 +697,7 @@ public class ClassLoaderWeavingAdaptorTest extends TestCase {
                }
 
                @Override
-               public List getDefinitions(final ClassLoader loader, final WeavingAdaptor adaptor) {
+               public List<Definition> getDefinitions(final ClassLoader loader, final WeavingAdaptor adaptor) {
                        return testList;
                }
        }
diff --git a/loadtime/testsrc/testdata/MessageService$$EnhancerByCGLIB$$6dd4e683.java b/loadtime/testsrc/testdata/MessageService$$EnhancerByCGLIB$$6dd4e683.java
new file mode 100644 (file)
index 0000000..4efd665
--- /dev/null
@@ -0,0 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Contributors.
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *  Andy Clement
+ *******************************************************************************/
+package testdata;
+
+public class MessageService$$EnhancerByCGLIB$$6dd4e683 {
+
+}