aboutsummaryrefslogtreecommitdiffstats
path: root/tests/new/TypeBug.java
blob: 76190d8196508c6c81e9fc5627f6201a86711063 (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
class TypeBug {

  public static void main(String[] args) {
    new TypeBug().go();
  }

    A a = new A();
    D d = new D();
    G g = new G();

  void go(){
    g.foo(a);
    g.foo(d);
    bar(g);
    bash(g);
  }

  void bar(I i){
    i.foo(a);
  }

  void bash(J j){
    j.foo(d);
  }

}

aspect Q {
 
  pointcut pc1(): receptions(void I.foo(*));
  pointcut pc2(): calls(void I.foo(*));
  pointcut pc3(): callsto(pc1());

  pointcut test():;

  static before(): pc1() {
    System.out.print("(pc1) ");
  }
 

  static before (): pc2() {
    System.out.print("(pc2) ");
  }

  static before(): pc3(){
    System.out.print("(pc3) ");
  }

}


class A {}


class D {}


interface I {
  void foo(A a);
}

interface J {
  void foo(D d);
}

class G implements I, J {
  public void foo(A a){
    System.out.println("G.foo(A)");
  }
  public void foo(D d){
    System.out.println("G.foo(D)");
  }
}