]> source.dussan.org Git - aspectj.git/commitdiff
Reproduce #314 gh-314 315/head
authorAlexander Kriegisch <Alexander@Kriegisch.name>
Thu, 18 Jul 2024 07:34:50 +0000 (09:34 +0200)
committerAlexander Kriegisch <Alexander@Kriegisch.name>
Thu, 18 Jul 2024 07:34:50 +0000 (09:34 +0200)
by refining and extending org.aspectj.systemtest.ajc171.NewFeatures,
also considering around advice types and repeated weaving, actually
re-using the cache.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
tests/features171/pr386341/X.aj
tests/src/test/resources/org/aspectj/systemtest/ajc171/newfeatures-tests.xml

index 3f467b53901201640588d105a8f2e18a7e58f10f..2dbab09a2a38e8fceeb10090613eb70a968d9923 100644 (file)
@@ -6,15 +6,23 @@
  * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
  *
  * Contributors:
- *    Andy Clement - Repro test case
+ *    Andy Clement - repro test case
  *    Abraham Nevado
+ *    Alexander Kriegisch - repro for GitHub 314
  *******************************************************************************/
 
 aspect X {
   after(): execution(* *.*()) {
     System.out.println("It Worked-after");
   }
+
   before(): execution(* *.*()) {
-        System.out.println("It Worked-before");
+    System.out.println("It Worked-before");
+  }
+
+  // Around advice reproduces GitHub 314 in connection with per-classloader cache
+  Object around(): execution(* *.*()) {
+    System.out.println("It Worked-around");
+    return proceed();
   }
 }
index 32f0f18459e28a92307128c2ad04e937aa334b03..6a18626e7b4af409e0ccac918d35fdbc7b567f4d 100644 (file)
@@ -2,40 +2,65 @@
 
 <!-- AspectJ v1.7.1 Features Tests -->
 <suite>
+
   <ajc-test dir="features171/pr386341" title="Test Shared Cache">
     <compile files="A.java" options="-1.5"/>
-    <compile files="X.aj" options="-1.5 -Xlint:ignore" />
-    <run class="A" ltw="aop.xml" usefullltw="true" vmargs="-Daj.weaving.cache.enabled=true -Daj.weaving.cache.dir=./ -Daj.weaving.cache.impl=shared" > 
-    <stdout>
-           <line text="It Worked-before"/>
-               <line text="It Worked-after"/>
-    </stdout>
+    <compile files="X.aj" options="-1.5 -Xlint:ignore"/>
+    <run class="A" ltw="aop.xml" usefullltw="true" vmargs="-Daj.weaving.cache.enabled=true -Daj.weaving.cache.dir=./ -Daj.weaving.cache.impl=shared">
+      <stdout>
+        <line text="It Worked-before"/>
+        <line text="It Worked-around"/>
+        <line text="It Worked-after"/>
+      </stdout>
+    </run>
+    <!-- Repeat run to actually re-use the cached files, reproducing GitHub issue 314 -->
+    <run class="A" ltw="aop.xml" usefullltw="true" vmargs="-Daj.weaving.cache.enabled=true -Daj.weaving.cache.dir=./ -Daj.weaving.cache.impl=shared">
+      <stdout>
+        <line text="It Worked-before"/>
+        <line text="It Worked-around"/>
+        <line text="It Worked-after"/>
+      </stdout>
     </run>
-  </ajc-test>  
-  
-   <ajc-test dir="features171/pr386341" title="Test Per ClassLoader Cache">
+  </ajc-test>
+
+  <ajc-test dir="features171/pr386341" title="Test Per ClassLoader Cache">
     <compile files="A.java" options="-1.5"/>
-    <compile files="X.aj" options="-1.5 -Xlint:ignore" />
-    <run class="A" ltw="aop.xml" usefullltw="true" vmargs="-Daj.weaving.cache.enabled=true -Daj.weaving.cache.dir=./ -Daj.weaving.cache.impl=perloader" > 
-    <stdout>
-           <line text="It Worked-before"/>
-               <line text="It Worked-after"/>
-    </stdout>
+    <compile files="X.aj" options="-1.5 -Xlint:ignore"/>
+    <run class="A" ltw="aop.xml" usefullltw="true" vmargs="-Daj.weaving.cache.enabled=true -Daj.weaving.cache.dir=./ -Daj.weaving.cache.impl=perloader">
+      <stdout>
+        <line text="It Worked-before"/>
+        <line text="It Worked-around"/>
+        <line text="It Worked-after"/>
+      </stdout>
+    </run>
+    <!-- Repeat run to actually re-use the cached files, reproducing GitHub issue 314 -->
+    <run class="A" ltw="aop.xml" usefullltw="true" vmargs="-Daj.weaving.cache.enabled=true -Daj.weaving.cache.dir=./ -Daj.weaving.cache.impl=perloader">
+      <stdout>
+        <line text="It Worked-before"/>
+        <line text="It Worked-around"/>
+        <line text="It Worked-after"/>
+      </stdout>
     </run>
-  </ajc-test>  
-  
+  </ajc-test>
+
   <ajc-test dir="features171/pr386341" title="Test Default Cache Per ClassLoader">
     <compile files="A.java" options="-1.5"/>
-    <compile files="X.aj" options="-1.5 -Xlint:ignore" />
-    <run class="A" ltw="aop.xml" usefullltw="true" vmargs="-Daj.weaving.cache.enabled=true -Daj.weaving.cache.dir=./" > 
-    <stdout>
-           <line text="It Worked-before"/>
-               <line text="It Worked-after"/>
-    </stdout>
+    <compile files="X.aj" options="-1.5 -Xlint:ignore"/>
+    <run class="A" ltw="aop.xml" usefullltw="true" vmargs="-Daj.weaving.cache.enabled=true -Daj.weaving.cache.dir=./">
+      <stdout>
+        <line text="It Worked-before"/>
+        <line text="It Worked-around"/>
+        <line text="It Worked-after"/>
+      </stdout>
+    </run>
+    <!-- Repeat run to actually re-use the cached files, reproducing GitHub issue 314 -->
+    <run class="A" ltw="aop.xml" usefullltw="true" vmargs="-Daj.weaving.cache.enabled=true -Daj.weaving.cache.dir=./">
+      <stdout>
+        <line text="It Worked-before"/>
+        <line text="It Worked-around"/>
+        <line text="It Worked-after"/>
+      </stdout>
     </run>
-  </ajc-test> 
-  
-  
-  
-</suite>
\ No newline at end of file
+  </ajc-test>
+
+</suite>