summaryrefslogtreecommitdiffstats
path: root/tests/bugs150/pr114343/case3/TestAspect.java
blob: 6d82c0f0e7260b70a4eac0ddf2c5a8b1b5f5f353 (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
import java.util.*;

public privileged aspect TestAspect {

  pointcut TestToArray(Test mt) : target(mt) && !within(TestAspect);

  pointcut getFirstExec(Test mt) :
    execution(* getFirst(..)) && target(mt) && !within(TestAspect);


  Object[] around(Test mt, Object[] objs) :
    TestToArray(mt) && args(objs) &&
    execution(Object[] Test.toArray(Object[])) {

    System.err.println("In around advice");
    objs = proceed(mt, objs);
    return objs;
  }

  Object around(Test mt): getFirstExec(mt) {
    System.err.println("around on getFirstExec(): running");
    return proceed(mt);
  }


  public static void main(String[] argv) {
     System.err.println("TestAspect.main: Calling foo");
     new TTT().foo();   
     Object o = new TTT().getFirst();   
     System.err.println("TestAspect.main: done");
  }
}