blob: d0e27211c5b81416463ccae92086da7ea2c2165e (
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
|
import org.aspectj.testing.Tester;
public class MultiAndAround {
public static void main(String[] args) {
exercise(new Base());
exercise(new Derived());
exercise(new SubBase());
Tester.checkEventsFromFile("MultiAndAround.out");
}
static void exercise(IBase b) {
Tester.event("**************************************");
b.base1("1");
b.base2("2");
b.base3("3");
}
}
interface IBase {
void base1(String s);
void base2(String s);
void base3(String s);
}
interface IDerived extends IBase {
void base1(String s);
}
class Base implements IBase {
public void base2(String s) { Tester.event("Base.base2"); }
}
class Derived implements IDerived {
public void base3(String s) { Tester.event("Derived.base3"); }
}
class SubBase extends Base {
public void base3(String s) { Tester.event("SubBase.base3"); }
}
aspect Intro {
public void IBase.base1(String s) { Tester.event("IBase.base1 from Intro"); }
public void IBase.base3(String s) { Tester.event("IBase.base3 from Intro"); }
public void IDerived.base1(String s) { Tester.event("IDerived.base1 from Intro"); }
public void IDerived.base2(String s) { Tester.event("IDerived.base2 from Intro"); }
public void IDerived.base3(String s) { Tester.event("IDerived.base3 from Intro"); }
}
aspect A {
Object around(): call(* IBase.*(..)) {
Tester.event("around call(IBase.*)");
return proceed();
}
Object around(): call(* IBase+.*(..)) {
Tester.event("around call(IBase+.*)");
return proceed();
}
Object around(): call(* Base.*(..)) {
Tester.event("around call(Base.*)");
return proceed();
}
Object around(): execution(* Base+.*(..)) {
Tester.event("around execution(Base+.*)");
return proceed();
}
}
|