-
Notifications
You must be signed in to change notification settings - Fork 82
/
Foo.java
89 lines (71 loc) · 1.51 KB
/
Foo.java
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
public class Foo {
int topInt= 0;
static int topStaticInt= 0;
public static void topInstance(Foo foo) {
foo.topInt++;
foo.topInt= foo.topInt;
foo.method();
foo.method();
foo.method();
}
public void method() {
}
public static void topStatic() {
topStaticInt++;
}
class Nested1 {
int nested1Int= 0;
static int nested1StaticInt= 0;
public void nested1Instance() {
topInt++;
Foo.this.topInt= topInt;
nested1Int++;
this.nested1Int++;
Nested1.this.nested1Int++;
Foo.topInstance(Foo.this);
Foo.topInstance(Foo.this);
topStatic();
}
public static void nested1Static() {
nested1StaticInt++;
}
class Nested2 {
int nested2Int= 0;
static int nested2StaticInt= 0;
public void nested2Instance() {
topInt++;
Foo.this.topInt= topInt;
nested1Int++;
Nested1.this.nested1Int++;
nested2Int++;
this.nested2Int++;
Nested2.this.nested2Int++;
Foo.topInstance(Foo.this);
Foo.topInstance(Foo.this);
topStatic();
nested1Instance();
Nested1.this.nested1Instance();
Nested1.nested1Static();
nested2Instance();
this.nested2Instance();
Nested2.nested2Static();
}
public static void nested2Static() {
nested2StaticInt++;
}
}
}
public void testAnonymousClass() {
new Object() {
int anonymousInt= 0;
public void anonymousMethod() {
anonymousInt++;
topInt++;
topStatic();
Foo.topInstance(Foo.this);
new Nested1().nested1Instance();
Nested1.Nested2.nested2Static();
}
};
}
}