aboutsummaryrefslogtreecommitdiffstats
path: root/tests/features151/ataround/A11.java
blob: b2e858b307b16bcc12b2f4536d4dff1cb8819218 (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
32
33
34
35
36
37
// only bind arg subset and change that subset
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;

@Aspect
public class A11 {
  M newM2 = new M("2");
  M newM3 = new M("3");

  @Around("call(void M.method(..)) && args(*,p,*) && this(t) && target(t2)")
  public void a( ProceedingJoinPoint pjp, M t,String p, M t2) throws Throwable {
    System.err.println("advice from ataj aspect");
    pjp.proceed(new Object[]{newM2,"_",newM3});
  }

  public static void main(String []argv) {
    M.main(argv);
  }
}

class M {

  String prefix;

  public M(String prefix) { this.prefix = prefix; }

  public static void main( String[] args ) {
    M m = new M("1");
    m.methodCaller("x","y","z");
  }

  public void methodCaller(String param,String param2,String param3) {
    method(param,param2,param3);
  }

  public void method(String a,String b,String c) { System.err.println(prefix+a+b+c); }
}