diff options
author | Alexander Kriegisch <Alexander@Kriegisch.name> | 2023-08-05 11:34:59 +0700 |
---|---|---|
committer | Alexander Kriegisch <Alexander@Kriegisch.name> | 2023-08-06 09:38:11 +0700 |
commit | 8170ae6ffd7068a3f224de0df2008d74d6b9d35b (patch) | |
tree | 7cd1f0e2653bbdea2b8783007a6b2e0abb2dcd5c /tests/bugs1920 | |
parent | b86246b87cfeec95e70122ad877d17fbf2e96b08 (diff) | |
download | aspectj-8170ae6ffd7068a3f224de0df2008d74d6b9d35b.tar.gz aspectj-8170ae6ffd7068a3f224de0df2008d74d6b9d35b.zip |
Add regression test for #250
Reproduces #250.
Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
Diffstat (limited to 'tests/bugs1920')
-rw-r--r-- | tests/bugs1920/github_250/MyAspect.aj | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/bugs1920/github_250/MyAspect.aj b/tests/bugs1920/github_250/MyAspect.aj new file mode 100644 index 000000000..e832d0f68 --- /dev/null +++ b/tests/bugs1920/github_250/MyAspect.aj @@ -0,0 +1,40 @@ +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; + +import java.util.Random; + +/** + * Reproduces <a href="https://github.com/eclipse-aspectj/aspectj/issues/250">Github bug 250</a> + */ +@Aspect +public class MyAspect { + @Around("execution(* Application.*(..))") + public Object myAdvice1(ProceedingJoinPoint joinPoint) { + System.out.println(joinPoint); + a(1, "one"); + return joinPoint.proceed(); + } + + @Around("execution(* Application.*(..))") + public Object myAdvice2(ProceedingJoinPoint joinPoint) throws Throwable { + System.out.println(joinPoint); + a(2); + return new Random().nextBoolean() ? joinPoint.proceed() : null; + } + + private void a(int i) { + System.out.println(i); + } + private void a(int i, String s) { + System.out.println(i + " / " + s); + } + + public static void main(String[] args) { + new Application().doSomething(); + } +} + +class Application { + public void doSomething() {} +} |