blob: 92289a5e91396e6a5fc8caec64833301749e55b0 (
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
|
import org.aspectj.testing.Tester;
import java.util.*;
public class AspectInheritance {
public static void main(String[] args) {
new C().m(2);
Tester.checkEqual(Base.aspectNames, "FullConcrete ConcreteFlow", "names");
}
}
abstract aspect Base {
public static Set aspectNames = new HashSet();
abstract pointcut targets(int i, C c);
after(int i, C c): targets(i, c) {
Base.aspectNames.add(this.getClass().getName());
}
}
aspect EmptyConcrete extends Base {
pointcut targets(int i, C c);
}
aspect FullConcrete extends Base {
pointcut targets(int i, C c): target(c) && call(void C.m(int)) && args(i);
}
abstract aspect Flow percflow(entries()) {
abstract pointcut entries();
{
Base.aspectNames.add(this.getClass().getName());
}
}
abstract aspect MainFlow extends Flow {
pointcut entries(): execution(void C.m(..));
}
aspect ConcreteFlow extends MainFlow { }
abstract aspect AbstractWorld {
before(): execution(void C.m(..)) {
System.out.println("before C.m");
}
}
class C {
public void m(int i) { }
}
|