aboutsummaryrefslogtreecommitdiffstats
path: root/tests/base/test107/Driver.java
blob: 2079b820d4455a68413de3e11ff22f3c1e52ec8c (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
import pack3.Foo;
import org.aspectj.testing.Tester;

public class Driver {
  public static void main(String[] args) { test(); }
  
  public static void test() {
    C1 c1 = new C1();
    C2 c2 = new C2();
    C3 c3 = new C3();

    Tester.checkEqual(c1.m(), 3, "c1.m()");
    Tester.checkEqual(c2.m(), 3, "c2.m()");
    Tester.checkEqual(c3.m(), 3, "c3.m()");
  }
}

class C3 {
  int m () {
    Foo f = new Foo();
    return f.hello();
  }
}

aspect Test {
     int around(): ( target(C1) || 
                                       target(C2)   ) && 
                   call(int m()) {
        Foo f = new Foo();
        return f.hello();
    }
}