blob: d72b04a1731223d4eb90f1e5a2e491b3f38ded2c (
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
|
import org.aspectj.testing.Tester;
public class Simple {
public static void main(String[] args) {
C c = new C();
I i = (I)new C("hi");
Tester.checkEqual(c.foo(), "foo:bar");
Tester.checkEqual(i.mumble(), "mumble:foo:bar");
Tester.checkEqual(A.Cm(), "from A");
Tester.checkEqual(B.Cm(), "from B");
c.idata = "c-mumble";
Tester.checkEqual(c.idata, "c-mumble");
Tester.checkEqual(i.idata, "mumble");
Tester.check("new A.C");
Tester.check("new B.C");
}
}
class C {
public C() { super(); }
public String bar() {return "bar"; }
}
interface I {
String foo();
String bar();
}
aspect A {
private String C.data = "foo";
private String C.data1 = this.data;
public String I.idata = "mumble";
public String C.foo() {
String s = this.data;
Tester.checkEqual(s, data1);
return data + ":" + bar();
}
declare parents: C implements I;
public String I.mumble() {
return idata + ":" + foo();
}
private String C.m() {
return "from A";
}
public static String Cm() {
return new C(2).m();
}
public C.new(String s) { this(); }
private C.new(int i) {
this(); Tester.note("new A.C");
}
}
aspect B {
private String C.data = "B";
private String C.m() {
return "from " + data;
}
public static String Cm() {
return new C(2).m();
}
private C.new(int i) {
this(); Tester.note("new B.C");
}
}
|