aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAlexander Kriegisch <Alexander@Kriegisch.name>2023-01-21 11:25:49 +0100
committerAlexander Kriegisch <Alexander@Kriegisch.name>2023-01-21 11:25:49 +0100
commit782cd415e2ae2c314ffbeec05ee303dd7bdf6a81 (patch)
tree09005410dbb257563049dd2114c9e037c83bf152 /tests
parent53837367b0f04a20aab530741ea7a24a42e309e5 (diff)
downloadaspectj-782cd415e2ae2c314ffbeec05ee303dd7bdf6a81.tar.gz
aspectj-782cd415e2ae2c314ffbeec05ee303dd7bdf6a81.zip
Add regression test reproducing GitHub #214
Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs1919/github_214/Application.java11
-rw-r--r--tests/bugs1919/github_214/FirstAspect.java11
-rw-r--r--tests/bugs1919/github_214/MarkerOne.java1
-rw-r--r--tests/bugs1919/github_214/MarkerTwo.java1
-rw-r--r--tests/bugs1919/github_214/SecondAspect.java12
-rw-r--r--tests/src/test/java/org/aspectj/systemtest/ajc1919/Bugs1919Tests.java4
-rw-r--r--tests/src/test/resources/org/aspectj/systemtest/ajc1919/ajc1919.xml28
7 files changed, 68 insertions, 0 deletions
diff --git a/tests/bugs1919/github_214/Application.java b/tests/bugs1919/github_214/Application.java
new file mode 100644
index 000000000..5401e0875
--- /dev/null
+++ b/tests/bugs1919/github_214/Application.java
@@ -0,0 +1,11 @@
+public class Application {
+ @MarkerTwo
+ @MarkerOne
+ public void greet(String name) {
+ System.out.println("Hello " + name + "!");
+ }
+
+ public static void main(String[] args) {
+ new Application().greet("world");
+ }
+}
diff --git a/tests/bugs1919/github_214/FirstAspect.java b/tests/bugs1919/github_214/FirstAspect.java
new file mode 100644
index 000000000..274e3a122
--- /dev/null
+++ b/tests/bugs1919/github_214/FirstAspect.java
@@ -0,0 +1,11 @@
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Before;
+
+@Aspect
+public class FirstAspect {
+ @Before("execution(@MarkerOne * *(..))")
+ public void beforeAdvice(JoinPoint joinPoint){
+ System.out.println("FirstAspect: " + joinPoint);
+ }
+}
diff --git a/tests/bugs1919/github_214/MarkerOne.java b/tests/bugs1919/github_214/MarkerOne.java
new file mode 100644
index 000000000..c59c42afc
--- /dev/null
+++ b/tests/bugs1919/github_214/MarkerOne.java
@@ -0,0 +1 @@
+public @interface MarkerOne { }
diff --git a/tests/bugs1919/github_214/MarkerTwo.java b/tests/bugs1919/github_214/MarkerTwo.java
new file mode 100644
index 000000000..213851d93
--- /dev/null
+++ b/tests/bugs1919/github_214/MarkerTwo.java
@@ -0,0 +1 @@
+public @interface MarkerTwo { }
diff --git a/tests/bugs1919/github_214/SecondAspect.java b/tests/bugs1919/github_214/SecondAspect.java
new file mode 100644
index 000000000..a4cc1bdb2
--- /dev/null
+++ b/tests/bugs1919/github_214/SecondAspect.java
@@ -0,0 +1,12 @@
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+
+@Aspect
+public class SecondAspect {
+ @Around("execution(@MarkerTwo * *(..))")
+ public Object around(ProceedingJoinPoint joinPoint) throws Throwable {
+ System.out.println("SecondAspect: " + joinPoint);
+ return joinPoint.proceed();
+ }
+}
diff --git a/tests/src/test/java/org/aspectj/systemtest/ajc1919/Bugs1919Tests.java b/tests/src/test/java/org/aspectj/systemtest/ajc1919/Bugs1919Tests.java
index c20f9f2cf..ba4f99ade 100644
--- a/tests/src/test/java/org/aspectj/systemtest/ajc1919/Bugs1919Tests.java
+++ b/tests/src/test/java/org/aspectj/systemtest/ajc1919/Bugs1919Tests.java
@@ -47,6 +47,10 @@ public class Bugs1919Tests extends XMLBasedAjcTestCase {
runTest("fuzzy array type matching, aspect compiled separately from target class");
}
+ public void test_GitHub_214() {
+ runTest("ArrayIndexOutOfBoundsException with Xlint unorderedAdviceAtShadow=warning");
+ }
+
public static Test suite() {
return XMLBasedAjcTestCase.loadSuite(Bugs1919Tests.class);
}
diff --git a/tests/src/test/resources/org/aspectj/systemtest/ajc1919/ajc1919.xml b/tests/src/test/resources/org/aspectj/systemtest/ajc1919/ajc1919.xml
index 15f5d18d6..5ff07be04 100644
--- a/tests/src/test/resources/org/aspectj/systemtest/ajc1919/ajc1919.xml
+++ b/tests/src/test/resources/org/aspectj/systemtest/ajc1919/ajc1919.xml
@@ -357,4 +357,32 @@
</run>
</ajc-test>
+ <!--
+ https://github.com/eclipse/org.aspectj/issues/214
+ https://github.com/mojohaus/aspectj-maven-plugin/issues/164
+ Problem with multiple, subsequent weaving steps and '-Xlint:warning' or '-Xlint:unorderedAdviceAtShadow=warning'
+ java.lang.ArrayIndexOutOfBoundsException: 1
+ [ERROR] at org.aspectj.weaver.bcel.BcelShadow.prepareForMungers(BcelShadow.java:379)
+ [ERROR] at org.aspectj.weaver.Shadow.implement(Shadow.java:546)
+ -->
+ <ajc-test dir="bugs1919/github_214" vm="1.5" title="ArrayIndexOutOfBoundsException with Xlint unorderedAdviceAtShadow=warning">
+ <compile files="FirstAspect.java MarkerOne.java" options="-1.8 -showWeaveInfo -Xlint:warning" outjar="first-aspect.jar">
+ <message kind="warning" text="can not build thisJoinPoint lazily for this advice since it has no suitable guard [Xlint:noGuardForLazyTjp]"/>
+ <message kind="warning" text="advice defined in FirstAspect has not been applied [Xlint:adviceDidNotMatch]"/>
+ </compile>
+ <compile files="Application.java MarkerTwo.java" options="-1.5 -showWeaveInfo -Xlint:warning" classpath="first-aspect.jar" outjar="application.jar"/>
+ <compile files="SecondAspect.java" options="-1.5 -showWeaveInfo -Xlint:warning" aspectpath="first-aspect.jar" inpath="application.jar" outjar="second-aspect.jar">
+ <message kind="warning" text="can not build thisJoinPoint lazily for this advice since it has no suitable guard [Xlint:noGuardForLazyTjp]"/>
+ <message kind="warning" text="at this shadow method-execution(void Application.greet(java.lang.String)) no precedence is specified between advice applying from aspect FirstAspect and aspect SecondAspect [Xlint:unorderedAdviceAtShadow]"/>
+ <message kind="warning" text="can not implement lazyTjp at joinpoint method-execution(void Application.greet(java.lang.String)) because of advice conflicts, see secondary locations to find conflicting advice [Xlint:multipleAdviceStoppingLazyTjp]"/>
+ <message kind="weave" text="method-execution(void Application.greet(java.lang.String))' in Type 'Application' (Application.java:4) advised by around advice from 'SecondAspect'"/>
+ <message kind="weave" text="method-execution(void Application.greet(java.lang.String))' in Type 'Application' (Application.java:4) advised by before advice from 'FirstAspect'"/>
+ </compile>
+ <run class="Application" classpath="second-aspect.jar first-aspect.jar">
+ <stdout>
+ <line text="Hello world!"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
</suite>