]> source.dussan.org Git - aspectj.git/commitdiff
Name annotation vs native style aspects uniformly in github_128 tests
authorAlexander Kriegisch <Alexander@Kriegisch.name>
Tue, 1 Mar 2022 04:31:17 +0000 (11:31 +0700)
committerAlexander Kriegisch <Alexander@Kriegisch.name>
Wed, 23 Mar 2022 08:39:14 +0000 (15:39 +0700)
Trying to find the difference between byte code generated by AJC for
functionally identical annotation vs native style aspect, I move the
aspects into subdirectories in order to be able to name them
identically. This way, when decompiling them with javap or Fernflower it
is easier to diff them later.

Why the decompilation? Because for the thread pool testing scenario
native syntax passes while annotation syntax fails. I.e., we need to
find the difference. That can be done by reading source code, if you
know where to look, or by starting with reverse engineering in order to
first understand more and look at the code later.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
tests/bugs198/github_128/MarkerAAspect.aj [deleted file]
tests/bugs198/github_128/MarkerANativeAspect.aj [deleted file]
tests/bugs198/github_128/MarkerBAspect.aj [deleted file]
tests/bugs198/github_128/MarkerBNativeAspect.aj [deleted file]
tests/bugs198/github_128/annotation_syntax/MarkerAAspect.aj [new file with mode: 0644]
tests/bugs198/github_128/annotation_syntax/MarkerBAspect.aj [new file with mode: 0644]
tests/bugs198/github_128/native_syntax/MarkerAAspect.aj [new file with mode: 0644]
tests/bugs198/github_128/native_syntax/MarkerBAspect.aj [new file with mode: 0644]
tests/src/test/resources/org/aspectj/systemtest/ajc198/ajc198.xml

diff --git a/tests/bugs198/github_128/MarkerAAspect.aj b/tests/bugs198/github_128/MarkerAAspect.aj
deleted file mode 100644 (file)
index d090ed9..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-import org.aspectj.lang.ProceedingJoinPoint;
-import org.aspectj.lang.annotation.Around;
-import org.aspectj.lang.annotation.Aspect;
-import org.aspectj.lang.annotation.DeclarePrecedence;
-
-@Aspect
-@DeclarePrecedence("MarkerAAspect, MarkerBAspect")
-public class MarkerAAspect {
-  @Around("@annotation(MarkerA) && execution(* *(..))")
-  public Object intercept(ProceedingJoinPoint thisJoinPoint) throws Throwable {
-    System.out.println(">> Outer intercept");
-    Object result = null;
-    for (int i = 0; i < Application.proceedTimesOuter; i++) {
-      System.out.println("  >> Outer proceed");
-      result = thisJoinPoint.proceed();
-      System.out.println("  << Outer proceed");
-    }
-    System.out.println("<< Outer intercept");
-    return result;
-  }
-}
diff --git a/tests/bugs198/github_128/MarkerANativeAspect.aj b/tests/bugs198/github_128/MarkerANativeAspect.aj
deleted file mode 100644 (file)
index 37d9f2f..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-public aspect MarkerANativeAspect {
-  declare precedence : MarkerANativeAspect, MarkerBNativeAspect;
-  public static int proceedTimes = 1;
-
-  Object around() : @annotation(MarkerA) && execution(* *(..)) {
-    System.out.println(">> Outer intercept");
-    Object result = null;
-    for (int i = 0; i < Application.proceedTimesOuter; i++) {
-      System.out.println("  >> Outer proceed");
-      result = proceed();
-      System.out.println("  << Outer proceed");
-    }
-    System.out.println("<< Outer intercept");
-    return result;
-  }
-}
diff --git a/tests/bugs198/github_128/MarkerBAspect.aj b/tests/bugs198/github_128/MarkerBAspect.aj
deleted file mode 100644 (file)
index d5548f9..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-import org.aspectj.lang.ProceedingJoinPoint;
-import org.aspectj.lang.annotation.Around;
-import org.aspectj.lang.annotation.Aspect;
-
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-@Aspect
-public class MarkerBAspect {
-  @Around("@annotation(MarkerB) && execution(* *(..))")
-  public Object intercept(ProceedingJoinPoint thisJoinPoint) throws Throwable {
-    Runnable runnable = new Runnable() {
-      @Override
-      public void run() {
-        try {
-          for (int i = 0; i < Application.proceedTimesInner; i++) {
-            System.out.println("      >> Inner proceed");
-            thisJoinPoint.proceed();
-            System.out.println("      << Inner proceed");
-          }
-        }
-        catch (Throwable throwable) {
-          throwable.printStackTrace(System.out);
-        }
-      }
-    };
-
-    System.out.println("    >> Inner intercept");
-    if (Application.useThreadPool)
-      Application.executorService.submit(runnable);
-    else
-      new Thread(runnable).start();
-    System.out.println("    << Inner intercept");
-    return null;
-  }
-}
diff --git a/tests/bugs198/github_128/MarkerBNativeAspect.aj b/tests/bugs198/github_128/MarkerBNativeAspect.aj
deleted file mode 100644 (file)
index 6bd4b86..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-public aspect MarkerBNativeAspect {
-  Object around() : @annotation(MarkerB) && execution(* *(..)) {
-    Runnable runnable = new Runnable() {
-      @Override
-      public void run() {
-        try {
-          for (int i = 0; i < Application.proceedTimesInner; i++) {
-            System.out.println("      >> Inner proceed");
-            proceed();
-            System.out.println("      << Inner proceed");
-          }
-        }
-        catch (Throwable throwable) {
-          throwable.printStackTrace(System.out);
-        }
-      }
-    };
-
-    System.out.println("    >> Inner intercept");
-    if (Application.useThreadPool)
-      Application.executorService.submit(runnable);
-    else
-      new Thread(runnable).start();
-    System.out.println("    << Inner intercept");
-    return null;
-  }
-}
diff --git a/tests/bugs198/github_128/annotation_syntax/MarkerAAspect.aj b/tests/bugs198/github_128/annotation_syntax/MarkerAAspect.aj
new file mode 100644 (file)
index 0000000..d090ed9
--- /dev/null
@@ -0,0 +1,21 @@
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.DeclarePrecedence;
+
+@Aspect
+@DeclarePrecedence("MarkerAAspect, MarkerBAspect")
+public class MarkerAAspect {
+  @Around("@annotation(MarkerA) && execution(* *(..))")
+  public Object intercept(ProceedingJoinPoint thisJoinPoint) throws Throwable {
+    System.out.println(">> Outer intercept");
+    Object result = null;
+    for (int i = 0; i < Application.proceedTimesOuter; i++) {
+      System.out.println("  >> Outer proceed");
+      result = thisJoinPoint.proceed();
+      System.out.println("  << Outer proceed");
+    }
+    System.out.println("<< Outer intercept");
+    return result;
+  }
+}
diff --git a/tests/bugs198/github_128/annotation_syntax/MarkerBAspect.aj b/tests/bugs198/github_128/annotation_syntax/MarkerBAspect.aj
new file mode 100644 (file)
index 0000000..d5548f9
--- /dev/null
@@ -0,0 +1,37 @@
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+@Aspect
+public class MarkerBAspect {
+  @Around("@annotation(MarkerB) && execution(* *(..))")
+  public Object intercept(ProceedingJoinPoint thisJoinPoint) throws Throwable {
+    Runnable runnable = new Runnable() {
+      @Override
+      public void run() {
+        try {
+          for (int i = 0; i < Application.proceedTimesInner; i++) {
+            System.out.println("      >> Inner proceed");
+            thisJoinPoint.proceed();
+            System.out.println("      << Inner proceed");
+          }
+        }
+        catch (Throwable throwable) {
+          throwable.printStackTrace(System.out);
+        }
+      }
+    };
+
+    System.out.println("    >> Inner intercept");
+    if (Application.useThreadPool)
+      Application.executorService.submit(runnable);
+    else
+      new Thread(runnable).start();
+    System.out.println("    << Inner intercept");
+    return null;
+  }
+}
diff --git a/tests/bugs198/github_128/native_syntax/MarkerAAspect.aj b/tests/bugs198/github_128/native_syntax/MarkerAAspect.aj
new file mode 100644 (file)
index 0000000..5e2ac54
--- /dev/null
@@ -0,0 +1,15 @@
+public aspect MarkerAAspect {
+  declare precedence : MarkerAAspect, MarkerBAspect;
+
+  Object around() : @annotation(MarkerA) && execution(* *(..)) {
+    System.out.println(">> Outer intercept");
+    Object result = null;
+    for (int i = 0; i < Application.proceedTimesOuter; i++) {
+      System.out.println("  >> Outer proceed");
+      result = proceed();
+      System.out.println("  << Outer proceed");
+    }
+    System.out.println("<< Outer intercept");
+    return result;
+  }
+}
diff --git a/tests/bugs198/github_128/native_syntax/MarkerBAspect.aj b/tests/bugs198/github_128/native_syntax/MarkerBAspect.aj
new file mode 100644 (file)
index 0000000..52e95d1
--- /dev/null
@@ -0,0 +1,27 @@
+public aspect MarkerBAspect {
+  Object around() : @annotation(MarkerB) && execution(* *(..)) {
+    Runnable runnable = new Runnable() {
+      @Override
+      public void run() {
+        try {
+          for (int i = 0; i < Application.proceedTimesInner; i++) {
+            System.out.println("      >> Inner proceed");
+            proceed();
+            System.out.println("      << Inner proceed");
+          }
+        }
+        catch (Throwable throwable) {
+          throwable.printStackTrace(System.out);
+        }
+      }
+    };
+
+    System.out.println("    >> Inner intercept");
+    if (Application.useThreadPool)
+      Application.executorService.submit(runnable);
+    else
+      new Thread(runnable).start();
+    System.out.println("    << Inner intercept");
+    return null;
+  }
+}
index 0e113278204529b7070d35ee81474e70433d8761..25f5692f20389fd87ca964eeb63c4a99707fe908 100644 (file)
        </ajc-test>
 
        <ajc-test dir="bugs198/github_128" title="asynchronous proceed for nested around-advice (@AspectJ)">
-               <compile files="Application.java MarkerA.java MarkerAAspect.aj MarkerB.java MarkerBAspect.aj" options="-1.8" />
+               <compile files="Application.java MarkerA.java MarkerB.java annotation_syntax/MarkerAAspect.aj annotation_syntax/MarkerBAspect.aj" options="-1.8" />
                <run class="Application" options="1,1">
                        <stdout ordered="no">
                                <line text=">> Outer intercept"/>
        </ajc-test>
 
        <ajc-test dir="bugs198/github_128" title="asynchronous proceed for nested around-advice (@AspectJ, thread pool)">
-               <compile files="Application.java MarkerA.java MarkerAAspect.aj MarkerB.java MarkerBAspect.aj" options="-1.8" />
+               <compile files="Application.java MarkerA.java MarkerB.java annotation_syntax/MarkerAAspect.aj annotation_syntax/MarkerBAspect.aj" options="-1.8" />
                <run class="Application" options="1,1,true">
                        <stdout ordered="no">
                                <line text=">> Outer intercept"/>
        </ajc-test>
 
        <ajc-test dir="bugs198/github_128" title="asynchronous proceed for nested around-advice (native)">
-               <compile files="Application.java MarkerA.java MarkerANativeAspect.aj MarkerB.java MarkerBNativeAspect.aj" options="-1.8" />
+               <compile files="Application.java MarkerA.java MarkerB.java native_syntax/MarkerAAspect.aj native_syntax/MarkerBAspect.aj" options="-1.8" />
                <run class="Application" options="1,1">
                        <stdout ordered="no">
                                <line text=">> Outer intercept"/>
        </ajc-test>
 
        <ajc-test dir="bugs198/github_128" title="asynchronous proceed for nested around-advice (native, thread pool)">
-               <compile files="Application.java MarkerA.java MarkerANativeAspect.aj MarkerB.java MarkerBNativeAspect.aj" options="-1.8" />
+               <compile files="Application.java MarkerA.java MarkerB.java native_syntax/MarkerAAspect.aj native_syntax/MarkerBAspect.aj" options="-1.8" />
                <run class="Application" options="1,1,true">
                        <stdout ordered="no">
                                <line text=">> Outer intercept"/>