123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485 |
-
- <!-- Load-time weaving tests -->
- <ajc-test dir="ltw"
- title="Ensure 1st aspect is rewoven when weaving 2nd aspect"
- keywords="reweavable">
- <compile
- files="Main.java, Aspect1.aj"
- outjar="main1.jar"
- options="-showWeaveInfo"
- >
- <message kind="weave" text="method-execution(void Main.test1())' in Type 'Main' (Main.java:17) advised by before advice from 'Aspect1' (Aspect1.aj:16)"/>
- </compile>
- <compile
- classpath="main1.jar"
- files="Aspect2.aj"
- outjar="aspect2.jar"
- options="-showWeaveInfo"
- >
- </compile>
- <run class="Main" ltw="aop-ltwreweavable.xml">
- <stdout>
- <line text="Main.main"/>
- <line text="Main.test1"/>
- <line text="Main.test2"/>
- </stdout>
- <stderr>
- <line text="weaveinfo Join point 'method-execution(void Main.test1())' in Type 'Main' (Main.java:17) advised by before advice from 'Aspect1' (Aspect1.aj:16)"/>
- <line text="weaveinfo Join point 'method-execution(void Main.test2())' in Type 'Main' (Main.java:21) advised by before advice from 'Aspect2' (Aspect2.aj:16)"/>
- <line text="Aspect1.before_test1"/>
- <line text="Aspect2.before_test2"/>
- </stderr>
- </run>
- </ajc-test>
-
- <ajc-test dir="ltw"
- title="Ensure valid aop.xml file is generated"
- keywords="-outxml">
- <compile
- files="Main.java"
- outjar="main.jar"
- >
- </compile>
- <compile
- classpath="main.jar"
- files="Aspect1.aj, Aspect2.aj, pakkage/Aspect3.aj"
- outxmlfile="META-INF/aop.xml"
- >
- </compile>
- <run class="Main" ltw="">
- <stdout>
- <line text="Main.main"/>
- <line text="Main.test1"/>
- <line text="Main.test2"/>
- </stdout>
- <stderr>
- <line text="Aspect1.before_test1"/>
- <line text="Aspect2.before_test2"/>
- <line text="pakkage.Aspect3.before_test2"/>
- </stderr>
- </run>
- </ajc-test>
-
- <ajc-test dir="ltw"
- title="Ensure valid aop.xml is generated for -outjar"
- keywords="-outxml">
- <compile
- files="Main.java"
- outjar="main.jar"
- >
- </compile>
- <compile
- classpath="main.jar"
- files="Aspect1.aj, Aspect2.aj, pakkage/Aspect3.aj"
- outjar="aspects.jar"
- options="-outxml"
- >
- </compile>
- <run class="Main" ltw="">
- <stdout>
- <line text="Main.main"/>
- <line text="Main.test1"/>
- <line text="Main.test2"/>
- </stdout>
- <stderr>
- <line text="Aspect1.before_test1"/>
- <line text="Aspect2.before_test2"/>
- <line text="pakkage.Aspect3.before_test2"/>
- </stderr>
- </run>
- </ajc-test>
-
- <ajc-test dir="ltw"
- title="Ensure no weaving without visible aop.xml"
- keywords="reweavable">
- <compile
- files="TestMain.java, Main.java"
- >
- </compile>
- <run class="TestMain" ltw="">
- <stdout>
- <line text="Main.main"/>
- <line text="Main.test1"/>
- <line text="Main.test2"/>
- </stdout>
- <stderr>
- <line text="info AspectJ Weaver Version"/>
- <line text="info register classloader org.aspectj.weaver.loadtime.WeavingURLClassLoader"/>
- <line text="info no configuration found. Disabling weaver for class loader org.aspectj.weaver.loadtime.WeavingURLClassLoader"/>
- </stderr>
- </run>
- </ajc-test>
-
-
- <ajc-test dir="ltw"
- title="Define concrete sub-aspect using aop.xml"
- keywords="aop.xml">
- <compile
- files="Main.java"
- outjar="main.jar"
- >
- </compile>
- <compile
- classpath="main1.jar"
- files="AbstractSuperAspect.aj"
- outjar="aspect.jar"
- >
- </compile>
- <run class="Main" ltw="aop-defineaspect.xml">
- <stdout>
- <line text="Main.main"/>
- <line text="Main.test1"/>
- <line text="Main.test2"/>
- </stdout>
- <stderr>
- <line text="info AspectJ Weaver Version"/>
- <line text="info register classloader"/>
- <line text="info using"/>
- <line text="info generating class 'ConcreteAspect'"/>
- <line text="info weaving 'Main'"/>
- <line text="AbstractSuperAspect.before_test1"/>
- </stderr>
- </run>
- </ajc-test>
-
- <ajc-test dir="ltw"
- title="Use abstract aspect for ITD using aop.xml"
- keywords="abstract aspect, ITD">
- <compile
- files="TestITDMethod.java"
- >
- </compile>
- <compile
- files="AbstractAspect.aj"
- >
- <message kind="warning" text="this affected type is not exposed to the weaver: TestITDMethod"/>
- </compile>
- <run class="TestITDMethod" options="test" ltw="aop-abstractaspect.xml">
- <stdout>
- <line text="TestITDMethod.main"/>
- </stdout>
- <stderr>
- <line text="weaveinfo Type 'TestITDMethod' (TestITDMethod.java) has intertyped method from 'AbstractAspect' (AbstractAspect.aj:'void TestITDMethod.test()')"/>
- <line text="AbstractAspect_TestITDMethod.test"/>
- </stderr>
- </run>
- </ajc-test>
-
- <ajc-test dir="ltw"
- title="Ensure a subset of inherited aspects is used for weaving"
- keywords="aspects, include">
- <compile
- files="Main.java"
- outjar="main.jar"
- >
- </compile>
- <compile
- classpath="main.jar"
- files="Aspect1.aj, Aspect2.aj, pakkage/Aspect3.aj"
- outjar="aspects.jar"
- options="-outxml"
- >
- </compile>
- <run class="Main" ltw="aop-aspectsinclude.xml">
- <stdout>
- <line text="Main.main"/>
- <line text="Main.test1"/>
- <line text="Main.test2"/>
- </stdout>
- <stderr>
- <line text="pakkage.Aspect3.before_test2"/>
- </stderr>
- </run>
- </ajc-test>
-
- <ajc-test dir="ltw"
- title="Ensure weaver lint warning issued when an aspect is not used for weaving"
- keywords="aspects, include, lint">
- <compile
- files="Main.java"
- outjar="main.jar"
- >
- </compile>
- <compile
- classpath="main.jar"
- files="Aspect1.aj, Aspect2.aj, pakkage/Aspect3.aj"
- outjar="aspects.jar"
- options="-outxml"
- >
- </compile>
- <run class="Main" ltw="aop-aspectsincludewithlintwarning.xml">
- <stdout>
- <line text="Main.main"/>
- <line text="Main.test1"/>
- <line text="Main.test2"/>
- </stdout>
- <stderr>
- <line text="warning aspect Aspect1 exluded for class loader org.aspectj.weaver.loadtime.WeavingURLClassLoader [Xlint:aspectExcludedByConfiguration]"/>
- <line text="warning aspect Aspect2 exluded for class loader org.aspectj.weaver.loadtime.WeavingURLClassLoader [Xlint:aspectExcludedByConfiguration]"/>
- <line text="pakkage.Aspect3.before_test2"/>
- </stderr>
- </run>
- </ajc-test>
-
- <ajc-test dir="ltw"
- title="Empty Xlint.properties file"
- keywords="xlint, ltw">
- <compile
- files="Main.java"
- >
- </compile>
- <run class="Main" ltw="aop-xlintfile.xml" xlintfile="Xlint-empty.properties">
- <stderr>
- </stderr>
- </run>
- </ajc-test>
-
- <ajc-test dir="ltw"
- title="Warning with missing Xlint.properties file"
- keywords="xlint, ltw">
- <compile
- files="Main.java"
- >
- </compile>
- <run class="Main" ltw="aop-xlintfile.xml">
- <stderr>
- <line text="warning Cannot access resource for -Xlintfile:Xlint-empty.properties"/>
- </stderr>
- </run>
- </ajc-test>
-
- <ajc-test dir="ltw"
- title="Warning when advice doesn't match suppressed for LTW"
- keywords="xlint, ltw">
- <compile
- files="Main.java"
- >
- </compile>
- <compile
- files="Aspect3.aj"
- >
- </compile>
- <run class="Main" ltw="aop-nomatch.xml">
- <stderr>
- <line text="info AspectJ Weaver Version"/>
- <line text="info register classloader"/>
- <line text="info using"/>
- <line text="info register aspect Aspect3"/>
- <line text="info weaving 'Main'"/>
- </stderr>
- </run>
- </ajc-test>
-
- <ajc-test dir="ltw"
- title="Override suppressing of warning when advice doesn't match using -Xlintfile"
- keywords="xlint, ltw">
- <compile
- files="Main.java"
- >
- </compile>
- <compile
- files="Aspect3.aj"
- >
- </compile>
- <run class="Main" ltw="aop-nomatchxlintfile.xml" xlintfile="Xlint-nomatch.properties">
- <stderr>
- <line text="info AspectJ Weaver Version"/>
- <line text="info register classloader"/>
- <line text="info using"/>
- <line text="info register aspect Aspect3"/>
- <line text="info weaving 'Main'"/>
- <!-- will never come out for LTW, due to pipelining change pr146781 -->
- <!--line text="advice defined in Aspect3 has not been applied [Xlint:adviceDidNotMatch]"/-->
- </stderr>
- </run>
- </ajc-test>
-
- <ajc-test dir="ltw"
- title="Warning when advice doesn't match using -Xlint:default"
- keywords="xlint, ltw">
- <compile
- files="Main.java"
- >
- </compile>
- <compile
- files="Aspect3.aj"
- >
- </compile>
- <run class="Main" ltw="aop-nomatchxlint.xml">
- <stderr>
- <line text="info AspectJ Weaver Version"/>
- <line text="info register classloader"/>
- <line text="info using"/>
- <line text="info register aspect Aspect3"/>
- <line text="info weaving 'Main'"/>
- <!-- will never come out for LTW, due to pipelining change pr146781 -->
- <!--line text="advice defined in Aspect3 has not been applied [Xlint:adviceDidNotMatch]"/-->
- </stderr>
- </run>
- </ajc-test>
-
- <ajc-test dir="ltw"
- title="Override suppressing of warning when advice doesn't match using -Xlint:warning"
- keywords="xlint, ltw">
- <compile
- files="Main.java"
- >
- </compile>
- <compile
- files="Aspect3.aj"
- >
- </compile>
- <run class="Main" ltw="aop-nomatchxlint.xml">
- <stderr>
- <line text="info AspectJ Weaver Version"/>
- <line text="info register classloader"/>
- <line text="info using"/>
- <line text="info register aspect Aspect3"/>
- <line text="info weaving 'Main'"/>
- <!-- will never come out for LTW, due to pipelining change pr146781 -->
- <!--line text="advice defined in Aspect3 has not been applied [Xlint:adviceDidNotMatch]"/-->
- </stderr>
- </run>
- </ajc-test>
-
- <!-- based on "Ensure 1st aspect is rewoven when weaving 2nd aspect" -->
- <ajc-test dir="ltw"
- title="Nonstandard jar file extensions" pr="137235">
- <compile
- files="folder.jar/Main.java, folder.jar/Aspect1.aj"
- outjar="folder.jar/main1.zip"
- options="-showWeaveInfo"
- >
- <message kind="weave" text="method-execution(void Main.test1())' in Type 'Main' (Main.java:17) advised by before advice from 'Aspect1' (Aspect1.aj:16)"/>
- </compile>
- <compile
- classpath="$sandbox/folder.jar/main1.zip"
- files="Aspect2.aj"
- outjar="aspect2Jar"
- options="-showWeaveInfo"
- >
- </compile>
- <run class="Main" ltw="aop-ltwreweavable.xml" classpath="$sandbox/folder.jar/main1.zip,$sandbox/aspect2Jar">
- <stdout>
- <line text="Main.main"/>
- <line text="Main.test1"/>
- <line text="Main.test2"/>
- </stdout>
- <stderr>
- <line text="weaveinfo Join point 'method-execution(void Main.test1())' in Type 'Main' (Main.java:17) advised by before advice from 'Aspect1' (Aspect1.aj:16)"/>
- <line text="weaveinfo Join point 'method-execution(void Main.test2())' in Type 'Main' (Main.java:21) advised by before advice from 'Aspect2' (Aspect2.aj:16)"/>
- <line text="Aspect1.before_test1"/>
- <line text="Aspect2.before_test2"/>
- </stderr>
- </run>
- </ajc-test>
-
- <ajc-test dir="ltw"
- title="Odd zip on classpath" pr="137235">
- <compile
- files="folder.jar/Main.java, folder.jar/Aspect1.aj"
- outjar="folder.jar/main1.archive"
- options="-showWeaveInfo"
- >
- <message kind="weave" text="method-execution(void Main.test1())' in Type 'Main' (Main.java:17) advised by before advice from 'Aspect1' (Aspect1.aj:16)"/>
- </compile>
- <compile
- classpath="$sandbox/folder.jar/main1.archive"
- files="Aspect2.aj"
- outjar="aspect2Jar"
- options="-showWeaveInfo"
- >
- </compile>
- <run class="Main" ltw="aop-ltwreweavable.xml" classpath="$sandbox/folder.jar/main1.archive,$sandbox/aspect2Jar">
- <stdout>
- <line text="Main.main"/>
- <line text="Main.test1"/>
- <line text="Main.test2"/>
- </stdout>
- <stderr>
- <line text="weaveinfo Join point 'method-execution(void Main.test1())' in Type 'Main' (Main.java:17) advised by before advice from 'Aspect1' (Aspect1.aj:16)"/>
- <line text="weaveinfo Join point 'method-execution(void Main.test2())' in Type 'Main' (Main.java:21) advised by before advice from 'Aspect2' (Aspect2.aj:16)"/>
- <line text="Aspect1.before_test1"/>
- <line text="Aspect2.before_test2"/>
- </stderr>
- </run>
- </ajc-test>
-
- <!--
- commented out: reported in another bugzilla bug...
-
- <ajc-test dir="ltw/hier"
- title="Separate compilation with ltw: declare parents and call"
- keywords="ltw">
- <compile
- files="util/A.aj,util/T.aj"
- />
- <compile
- files="child/Executor.aj,child/Advisor.aj,top/SimpleMain.aj"
- >
- <message kind="warning" text="this affected type is not exposed to the weaver: util.A"/>
- </compile>
- <run class="top.SimpleMain" ltw="aop-single.xml">
- <stdout>
- <line text="T call"/>
- </stdout>
- <stderr>
- <line text="weaveinfo Extending interface set for type 'util.A' (A.aj) to include 'util.T' (Advisor.aj)"/>
- < - - TODO: fix up any errors in the expected output when the join point actually matches - - >
- <line text="weaveinfo Join point 'method-call(void A.foo())' in Type 'child.Executor' (Executor.aj:19) advised by before advice from 'child.Advisor' (Advisor.aj:20)"/>
- </stderr>
- </run>
- </ajc-test>
-
- <ajc-test dir="ltw/hier"
- title="Child loader aspect won't weave parent loader: declare parents and call"
- keywords="ltw">
- <compile
- files="top/HierMain.aj"
- />
- <compile
- files="util/A.aj,util/T.aj"
- outjar="util.jar"
- />
- <compile
- files="child/Executor.aj,child/Advisor.aj"
- classpath="util.jar"
- options="-outxml"
- outjar="child.zip"
- >
- <message kind="warning" text="this affected type is not exposed to the weaver: util.A"/>
- </compile>
- < - - limitation: to turn on load-time weaving we HAVE to have a top-level aop.xml file
- since we don't want any top-level aspects, we deploy an empty one!
- the important aop.xml file in this test was created with -outxml and lives in child.jar - - >
- <run class="top.HierMain" ltw="null-aop.xml">
- <stdout/>
- <stderr>
- <line text="info AspectJ Weaver Version"/>
- <line text="info register classloader"/>
- <line text="info using"/>
- <line text="info weaving 'top.HierMain'"/>
- <line text="info AspectJ Weaver Version"/>
- <line text="info register classloader"/>
- <line text="info using"/>
- <line text="info using file:"/>
- <line text="info register aspect child.Advisor"/>
- <line text="info weaving 'child.Executor'"/>
- <line text="info weaving 'util.A'"/>
- </stderr>
- </run>
- </ajc-test>
- -->
- <ajc-test dir="ltw" title="JDK14 LTW with XML" keywords="ltw">
- <compile files="HelloWorld.java" options="-outjar hello.jar"/>
- <compile files="ExceptionHandler.aj" options="-outxml -outjar handler.jar"/>
- <ant file="ant.xml" target="JDK14 LTW with XML" verbose="true"/>
- </ajc-test>
-
- <ajc-test dir="ltw" title="JDK14 LTW with ASPECTPATH" keywords="ltw">
- <compile files="HelloWorld.java" options="-outjar hello.jar"/>
- <compile files="ExceptionHandler.aj" options="-outjar handler.jar"/>
- <ant file="ant.xml" target="JDK14 LTW with ASPECTPATH" verbose="true"/>
- </ajc-test>
-
-
|