blob: c25fd3be8a78a25ed00b4f76908497af5764427b (
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
83
84
85
86
87
88
89
90
91
92
93
|
import org.aspectj.testing.*;
// todo: package-qualified calls
/** PR651 PUREJAVA qualified super method calls */
public class QualifiedSuperCall {
public static void main (String[] args) {
Super s;
s = new Super();
Tester.check(null != s, "new Super()");
s = new Sub();
Tester.check(null != s, "new Sub()");
s = new UnqualifiedSub();
Tester.check(null != s, "new UnqualifiedSub()");
s = new SubSub();
Tester.check(null != s, "new SubSub()");
s = new UnqualifiedSubSub();
Tester.check(null != s, "new UnqualifiedSubSub()");
s = new Mid();
Tester.check(null != s, "new Mid()");
s = new SubMid();
Tester.check(null != s, "new SubMid()");
s = new UnqualifiedSubMid();
Tester.check(null != s, "new UnqualifiedSubMid()");
}
static {
Tester.m("Super.duper=Sub()");
Tester.m("Super.duper=UnqualifiedSub()");
Tester.m("Super.duper=SubSub()");
Tester.m("Super.duper=UnqualifiedSubSub()");
Tester.m("Super.duper=SubMid()");
Tester.m("Mid.duper=SubMid()");
Tester.m("Mid.duper=UnqualifiedSubMid()");
}
}
class Super {
Super() {}
void duper(String caller) {
Tester.event("Super.duper=" + caller);
}
}
class Sub extends Super {
Sub() {
Super.super();
Super.super.duper("Sub()");
}
}
class UnqualifiedSub extends Super {
UnqualifiedSub() {
super();
super.duper("UnqualifiedSub()");
}
}
class SubSub extends Sub {
SubSub() {
Sub.super();
Sub.super.duper("SubSub()");
}
}
class UnqualifiedSubSub extends UnqualifiedSub {
UnqualifiedSubSub() {
super();
super.duper("UnqualifiedSubSub()");
}
}
class Mid extends Super {
Mid() { }
void duper(String caller) {
Tester.event("Mid.duper=" + caller);
}
}
class SubMid extends Mid {
SubMid() {
Mid.super(); // XXX illegal ordering?
Super.super();
Super.super.duper("SubMid()");
Mid.super.duper("SubMid()");
}
}
class UnqualifiedSubMid extends Mid {
UnqualifiedSubMid() {
super();
super.duper("UnqualifiedSubMid()");
}
}
|