aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs1920/github_250/MyAspect.aj
diff options
context:
space:
mode:
Diffstat (limited to 'tests/bugs1920/github_250/MyAspect.aj')
-rw-r--r--tests/bugs1920/github_250/MyAspect.aj40
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() {}
+}