From 782cd415e2ae2c314ffbeec05ee303dd7bdf6a81 Mon Sep 17 00:00:00 2001 From: Alexander Kriegisch Date: Sat, 21 Jan 2023 11:25:49 +0100 Subject: Add regression test reproducing GitHub #214 Signed-off-by: Alexander Kriegisch --- tests/bugs1919/github_214/Application.java | 11 +++++++++ tests/bugs1919/github_214/FirstAspect.java | 11 +++++++++ tests/bugs1919/github_214/MarkerOne.java | 1 + tests/bugs1919/github_214/MarkerTwo.java | 1 + tests/bugs1919/github_214/SecondAspect.java | 12 ++++++++++ .../aspectj/systemtest/ajc1919/Bugs1919Tests.java | 4 ++++ .../org/aspectj/systemtest/ajc1919/ajc1919.xml | 28 ++++++++++++++++++++++ 7 files changed, 68 insertions(+) create mode 100644 tests/bugs1919/github_214/Application.java create mode 100644 tests/bugs1919/github_214/FirstAspect.java create mode 100644 tests/bugs1919/github_214/MarkerOne.java create mode 100644 tests/bugs1919/github_214/MarkerTwo.java create mode 100644 tests/bugs1919/github_214/SecondAspect.java 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 @@ + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3