blob: 7e8412eac7285ffcf1f881e741198fd67ab25afa (
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
74
75
76
77
78
79
80
81
82
|
import org.aspectj.testing.Tester;
public class Overriding {
public static void main(String[] args) {
SuperC sc = new C();
Tester.checkEqual(sc.m(), "A2");
Tester.checkEqual(A3.getMi(sc), "A3.I2");
Tester.checkEqual(A4.getMi(sc), "A4.I2");
Tester.checkEqual(A3.getM2(sc), "A3.Inner");
Tester.checkEqual(A4.getM2(sc), "A4.Inner");
}
}
abstract class SuperC { }
class C extends SuperC {}
class SubC extends C {}
aspect A1 {
abstract String SuperC.m();
}
aspect A2 {
String C.m() {
return "A2";
}
}
class A3 {
static aspect I1 {
private abstract String SuperC.mi();
}
static aspect I2 {
private String C.mi() {
return "A3.I2";
}
}
public static String getMi(SuperC sc) {
return sc.mi();
}
static aspect Inner {
private abstract String SuperC.m2();
private String C.m2() {
return "A3.Inner";
}
}
public static String getM2(SuperC sc) {
return sc.m2();
}
}
class A4 {
static aspect I1 {
private abstract String SuperC.mi();
}
static aspect I2 {
private String C.mi() {
return "A4.I2";
}
}
public static String getMi(SuperC sc) {
return sc.mi();
}
static aspect Inner {
private abstract String SuperC.m2();
private String C.m2() {
return "A4.Inner";
}
}
public static String getM2(SuperC sc) {
return sc.m2();
}
}
|