summaryrefslogtreecommitdiffstats
path: root/tests/features151/ataround/BugCase2.java
blob: e12cb6e4e6c4fd8fee4d8f2e41d9efacf82a3c58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import org.aspectj.lang.*;
import org.aspectj.lang.annotation.*;

@Aspect
public class BugCase2 {

  @Pointcut("execution(* setAge(..)) && args(i)")
  void setAge(int i) {}

 @Around("setAge(i)")
 public Object twiceAsOld(ProceedingJoinPoint thisJoinPoint, int i) {
   System.err.println("advice running");
   return thisJoinPoint.proceed(new Object[]{i*2});
 }
  public static void main(String []argv) {
    Foo.main(argv);
  }
}


 class Foo {
  int a;
  public void setAge(int i) {
     System.err.println("Setting age to "+i);
     a=i;
  }

  public static void main(String[]argv) {
    new Foo().setAge(5);
  }
}