diff options
author | aclement <aclement> | 2010-08-10 15:11:54 +0000 |
---|---|---|
committer | aclement <aclement> | 2010-08-10 15:11:54 +0000 |
commit | 85fd25dc91475e6b9926b5c740f73b994eb84a49 (patch) | |
tree | bf443cb668ea0a77c8399a067668ca3e701e6cdf /loadtime | |
parent | 19a0acd18c64bcbdb64deceb1daf5387abb983e8 (diff) | |
download | aspectj-85fd25dc91475e6b9926b5c740f73b994eb84a49.tar.gz aspectj-85fd25dc91475e6b9926b5c740f73b994eb84a49.zip |
321641: test and fix: exclusion for double dollared names (eg. cglib)
Diffstat (limited to 'loadtime')
3 files changed, 31 insertions, 8 deletions
diff --git a/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java b/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java index 134de582f..b3a5f05be 100644 --- a/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java +++ b/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java @@ -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) { diff --git a/loadtime/testsrc/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptorTest.java b/loadtime/testsrc/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptorTest.java index 9565e8ce1..456fde121 100644 --- a/loadtime/testsrc/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptorTest.java +++ b/loadtime/testsrc/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptorTest.java @@ -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 index 000000000..4efd665eb --- /dev/null +++ b/loadtime/testsrc/testdata/MessageService$$EnhancerByCGLIB$$6dd4e683.java @@ -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 { + +} |