From: Alexander Kriegisch Date: Tue, 1 Mar 2022 04:31:17 +0000 (+0700) Subject: Name annotation vs native style aspects uniformly in github_128 tests X-Git-Tag: V1_9_9~8^2~1 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e18c4f92938b117eaea32a340ea1ba65fa0585ae;p=aspectj.git Name annotation vs native style aspects uniformly in github_128 tests 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 --- diff --git a/tests/bugs198/github_128/MarkerAAspect.aj b/tests/bugs198/github_128/MarkerAAspect.aj deleted file mode 100644 index d090ed9ea..000000000 --- a/tests/bugs198/github_128/MarkerAAspect.aj +++ /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 index 37d9f2fee..000000000 --- a/tests/bugs198/github_128/MarkerANativeAspect.aj +++ /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 index d5548f9da..000000000 --- a/tests/bugs198/github_128/MarkerBAspect.aj +++ /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 index 6bd4b8683..000000000 --- a/tests/bugs198/github_128/MarkerBNativeAspect.aj +++ /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 index 000000000..d090ed9ea --- /dev/null +++ b/tests/bugs198/github_128/annotation_syntax/MarkerAAspect.aj @@ -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 index 000000000..d5548f9da --- /dev/null +++ b/tests/bugs198/github_128/annotation_syntax/MarkerBAspect.aj @@ -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 index 000000000..5e2ac5424 --- /dev/null +++ b/tests/bugs198/github_128/native_syntax/MarkerAAspect.aj @@ -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 index 000000000..52e95d1eb --- /dev/null +++ b/tests/bugs198/github_128/native_syntax/MarkerBAspect.aj @@ -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; + } +} diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc198/ajc198.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc198/ajc198.xml index 0e1132782..25f5692f2 100644 --- a/tests/src/test/resources/org/aspectj/systemtest/ajc198/ajc198.xml +++ b/tests/src/test/resources/org/aspectj/systemtest/ajc198/ajc198.xml @@ -168,7 +168,7 @@ - + @@ -247,7 +247,7 @@ - + @@ -326,7 +326,7 @@ - + @@ -405,7 +405,7 @@ - +