blob: 729315fd127f99201fab9757adf54488a5b1d5da (
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
|
public class PR353e {
public static void main(String[] args){
new PR353e().go();
}
void go(){
C c;
// System.out.println("\nwith C...");
// c = new C();
// c.foo(this);
// c.bar(this);
// System.out.println("\nwith D...");
// c = new D();
// c.foo(this);
// c.bar(this);
// System.out.println("\nwith CE...");
// c = new E();
// c.foo(this);
System.out.println("\nwith E...");
E e = new E();
e.foo(this);
System.out.println("\nwith E2...");
E2 e2 = new E2();
e2.foo(this);
e2.bar(this);
}
}
interface I { }
class C{
void foo(PR353e a){ System.out.println("foo"); }
}
class E extends C implements I { }
class E2 extends C implements I { void foo(PR353e a) { System.out.println("foo2"); } }
aspect A {
pointcut p(C c): receptions(* *(PR353e)) && instanceof(c) && !instanceof(E);
static before(C c): p(c) {
System.out.println("1 before A " + thisJoinPoint.methodName + " with:" + c + ":" + thisJoinPoint.className);
}
pointcut p3(): receptions(* *(PR353e)) && !instanceof(E);
static before(): p3() {
System.out.println("3 before A " + thisJoinPoint.methodName + " with:" + thisJoinPoint.className);
}
pointcut p4(): receptions(* *(PR353e)) && !instanceof(E2);
static before(): p4() {
System.out.println("4 before A " + thisJoinPoint.methodName + " with:" + thisJoinPoint.className);
}
}
aspect B {
pointcut p(C c): receptions(* *(PR353e)) && instanceof(c) && !instanceof(E);
static before(C c): p(c) {
System.out.println("1 before B " + thisJoinPoint.methodName + " with:" + c + ":" + thisJoinPoint.className);
}
pointcut p3(): receptions(* *(PR353e)) && !instanceof(E);
static before(): p3() {
System.out.println("3 before B " + thisJoinPoint.methodName + " with:" + thisJoinPoint.className);
}
}
|