blob: f4926eec7840138ab87d325947d80f3bb7056878 (
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
|
import org.aspectj.testing.Tester;
import org.aspectj.testing.Tester;
/*
* Calls to methods declared in outer annonymous classes
* are being qualified with this when they shouldn't.
*/
public class MisplacedThisInAnnonymousInnerClasses {
public static void main(String[] args) {
new MisplacedThisInAnnonymousInnerClasses().realMain(args);
}
public void realMain(String[] args) {
Tester.expectEvent("run0");
Tester.expectEvent("run1");
Tester.expectEvent("run2");
Tester.expectEvent("run3");
Tester.expectEvent("outer0");
Tester.expectEvent("outer1");
Tester.expectEvent("outer2");
new Runnable() {
public void outer(int i) { Tester.event("outer"+i); }
public void run() {
Tester.event("run0");
new Runnable() {
public void run() {
Tester.event("run1");
// shouldn't become this.outer(0)
outer(0);
new Runnable() {
public void run() {
Tester.event("run2");
// shouldn't become this.outer(1)
outer(1);
new Runnable() {
public void run() {
Tester.event("run3");
// shouldn't become
// this.outer(2)
outer(2);
}
}.run();
}
}.run();
}
}.run();
}
}.run();
Tester.checkAllEvents();
}
}
|