diff options
author | avasseur <avasseur> | 2005-07-18 14:58:41 +0000 |
---|---|---|
committer | avasseur <avasseur> | 2005-07-18 14:58:41 +0000 |
commit | f632b6ee2fc4ed7e252e231c03c93ba12f5f1dbb (patch) | |
tree | 456141208f0cae200fa31dbe1d988cec7e886515 | |
parent | de064586adce1a43081832aefa88d27e883cb81e (diff) | |
download | aspectj-f632b6ee2fc4ed7e252e231c03c93ba12f5f1dbb.tar.gz aspectj-f632b6ee2fc4ed7e252e231c03c93ba12f5f1dbb.zip |
ltw reweavable test for Mattew bug, fix some wrong getCoreType that makes some stderr output when closure are encountered on ltw / dump
9 files changed, 160 insertions, 3 deletions
diff --git a/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java b/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java index ee0783088..f018c0131 100644 --- a/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java +++ b/loadtime/src/org/aspectj/weaver/loadtime/ClassLoaderWeavingAdaptor.java @@ -250,7 +250,7 @@ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor { return true; } //TODO AV - optimize for className.startWith only - ResolvedType classInfo = weaver.getWorld().getCoreType(UnresolvedType.forName(className)); + ResolvedType classInfo = weaver.getWorld().resolve(UnresolvedType.forName(className), true); //exclude for (Iterator iterator = m_excludeTypePattern.iterator(); iterator.hasNext();) { TypePattern typePattern = (TypePattern) iterator.next(); @@ -275,7 +275,7 @@ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor { return true; } //TODO AV - optimize for className.startWith only - ResolvedType classInfo = weaver.getWorld().getCoreType(UnresolvedType.forName(aspectClassName)); + ResolvedType classInfo = weaver.getWorld().resolve(UnresolvedType.forName(aspectClassName), true); //exclude for (Iterator iterator = m_aspectExcludeTypePattern.iterator(); iterator.hasNext();) { TypePattern typePattern = (TypePattern) iterator.next(); @@ -293,7 +293,7 @@ public class ClassLoaderWeavingAdaptor extends WeavingAdaptor { return false; } //TODO AV - optimize for className.startWith only - ResolvedType classInfo = weaver.getWorld().getCoreType(UnresolvedType.forName(className)); + ResolvedType classInfo = weaver.getWorld().resolve(UnresolvedType.forName(className), true); //dump for (Iterator iterator = m_dumpTypePattern.iterator(); iterator.hasNext();) { TypePattern typePattern = (TypePattern) iterator.next(); diff --git a/tests/java5/ataspectj/ajc-ant.xml b/tests/java5/ataspectj/ajc-ant.xml index bd5f98a2b..5cdd58ebe 100644 --- a/tests/java5/ataspectj/ajc-ant.xml +++ b/tests/java5/ataspectj/ajc-ant.xml @@ -60,4 +60,23 @@ </target> <target name="javac.ltw" depends="compile:javac, ltw"/> + + <target name="ltw.Aspect2MainTest"> + <!-- javac Aspect2 --> + <javac destdir="${aj.sandbox}" classpathref="aj.path" + srcdir="${basedir}" + includes="ataspectj/ltwreweavable/Aspect2.java" + debug="true"> + </javac> + <delete dir="${aj.sandbox}" includes="**/Aspect1.class, **/Main.class"/> + <java fork="yes" classname="ataspectj.ltwreweavable.Main" failonerror="yes"> + <classpath refid="aj.path"/> + <classpath> + <pathelement path="${aj.sandbox}/main1.jar"/> + </classpath> + <jvmarg value="-javaagent:${aj.root}/lib/test/loadtime5.jar"/> + <jvmarg value="-Daj5.def=ataspectj/ltwreweavable/aop-ltwreweavable.xml"/> + </java> + + </target> </project>
\ No newline at end of file diff --git a/tests/java5/ataspectj/ataspectj/ltwreweavable/Advisable.java b/tests/java5/ataspectj/ataspectj/ltwreweavable/Advisable.java new file mode 100644 index 000000000..bec7654d7 --- /dev/null +++ b/tests/java5/ataspectj/ataspectj/ltwreweavable/Advisable.java @@ -0,0 +1,20 @@ +/******************************************************************************* + * Copyright (c) 2005 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: + * Alexandre Vasseur initial implementation + *******************************************************************************/ +package ataspectj.ltwreweavable; + +/** + * @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a> + */ +public interface Advisable { + + public void addJoinPoint (String name); +} diff --git a/tests/java5/ataspectj/ataspectj/ltwreweavable/Aspect1.java b/tests/java5/ataspectj/ataspectj/ltwreweavable/Aspect1.java new file mode 100644 index 000000000..5ec5508c2 --- /dev/null +++ b/tests/java5/ataspectj/ataspectj/ltwreweavable/Aspect1.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * Copyright (c) 2005 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: + * Alexandre Vasseur initial implementation + *******************************************************************************/ +package ataspectj.ltwreweavable; + +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Before; +import org.aspectj.lang.JoinPoint; + +/** + * @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a> + */ +@Aspect +public class Aspect1 { + + @Before("execution(void ataspectj.ltwreweavable.Main.test1()) && this(a)") + public void before(Advisable a, JoinPoint thisJoinPoint) { + System.err.println(thisJoinPoint); + a.addJoinPoint(thisJoinPoint.getSignature().getName()); + } +} diff --git a/tests/java5/ataspectj/ataspectj/ltwreweavable/Aspect2.java b/tests/java5/ataspectj/ataspectj/ltwreweavable/Aspect2.java new file mode 100644 index 000000000..c1f609f5d --- /dev/null +++ b/tests/java5/ataspectj/ataspectj/ltwreweavable/Aspect2.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * Copyright (c) 2005 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: + * Alexandre Vasseur initial implementation + *******************************************************************************/ +package ataspectj.ltwreweavable; + +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Before; +import org.aspectj.lang.JoinPoint; + +/** + * @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a> + */ +@Aspect +public class Aspect2 { + + @Before("execution(void ataspectj.ltwreweavable.Main.test2()) && this(a)") + public void before(Advisable a, JoinPoint thisJoinPoint) { + System.err.println(thisJoinPoint); + a.addJoinPoint(thisJoinPoint.getSignature().getName()); + } +} diff --git a/tests/java5/ataspectj/ataspectj/ltwreweavable/Main.java b/tests/java5/ataspectj/ataspectj/ltwreweavable/Main.java new file mode 100644 index 000000000..13f16d127 --- /dev/null +++ b/tests/java5/ataspectj/ataspectj/ltwreweavable/Main.java @@ -0,0 +1,44 @@ +/******************************************************************************* + * Copyright (c) 2005 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: + * Alexandre Vasseur initial implementation + *******************************************************************************/ +package ataspectj.ltwreweavable; + +import java.util.List; +import java.util.ArrayList; + +/** + * @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a> + */ +public class Main implements Advisable { + + private static List joinPoints = new ArrayList(); + + public void test1 () { + + } + + public void test2 () { + + } + + public void addJoinPoint (String name) { + joinPoints.add(name); + } + + public static void main (String[] args) { + joinPoints = new ArrayList(); + new Main().test1(); + new Main().test2(); + if (joinPoints.size() != 2) { + throw new RuntimeException("size=" + joinPoints.size()); + } + } +} diff --git a/tests/java5/ataspectj/ataspectj/ltwreweavable/aop-ltwreweavable.xml b/tests/java5/ataspectj/ataspectj/ltwreweavable/aop-ltwreweavable.xml new file mode 100644 index 000000000..ba72cec4d --- /dev/null +++ b/tests/java5/ataspectj/ataspectj/ltwreweavable/aop-ltwreweavable.xml @@ -0,0 +1,4 @@ +<aspectj> + <aspect name="ataspectj.ltwreweavable.Aspect1"/> + <aspect name="ataspectj.ltwreweavable.Aspect2"/> +</aspectj>
\ No newline at end of file diff --git a/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java b/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java index e6e354de6..5b8a25982 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java +++ b/tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjLTWTests.java @@ -70,4 +70,8 @@ public class AtAjLTWTests extends XMLBasedAjcTestCase { runTest("LTW DumpTest"); } + public void testAjcAspect1LTWAspect2_Xreweavable() { + runTest("Ajc Aspect1 LTW Aspect2 -Xreweavable"); + } + } diff --git a/tests/src/org/aspectj/systemtest/ajc150/ataspectj/ltw.xml b/tests/src/org/aspectj/systemtest/ajc150/ataspectj/ltw.xml index 6cd0caccc..7749ae32b 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/ataspectj/ltw.xml +++ b/tests/src/org/aspectj/systemtest/ajc150/ataspectj/ltw.xml @@ -86,4 +86,12 @@ <ant file="ajc-ant.xml" target="ltw.DumpTest" verbose="true"/> </ajc-test> + <ajc-test dir="java5/ataspectj" title="Ajc Aspect1 LTW Aspect2 -Xreweavable"> + <compile + files="ataspectj/ltwreweavable/Main.java,ataspectj/ltwreweavable/Aspect1.java,ataspectj/ltwreweavable/Advisable.java" + options="-1.5 -Xreweavable" + outjar="main1.jar"/> + <ant file="ajc-ant.xml" target="ltw.Aspect2MainTest" verbose="true"/> + </ajc-test> + </suite>
\ No newline at end of file |