Thu, 25 Jul 2013 14:51:40 +0100
8020843: javac crashes on accessibility check with method reference with typevar receiver
Summary: method reference overload check doesn't walk through type-variable receivers
Reviewed-by: jjg
1 /*
2 * @test /nodynamiccopyright/
3 * @bug 4037746 4277279 4350658 4785453
4 * @summary Verify that an inner class cannot have the same simple name as an enclosing one.
5 * @author William Maddox (maddox)
6 *
7 * @compile/fail/ref=NestedInnerClassNames.out -XDrawDiagnostics NestedInnerClassNames.java
8 */
10 /*
11 * This program should compile with errors as marked.
12 */
14 public class NestedInnerClassNames {
16 class NestedInnerClassNames {} // ERROR
18 void m1() {
19 class NestedInnerClassNames {} // ERROR
20 }
22 class foo {
23 class foo { } // ERROR
24 }
26 void m2 () {
27 class foo {
28 class foo { } // ERROR
29 }
30 }
32 class bar {
33 class foo { }
34 class NestedInnerClassNames {} // ERROR
35 }
37 void m3() {
38 class bar {
39 class foo { }
40 class NestedInnerClassNames {} // ERROR
41 }
42 }
44 class baz {
45 class baz { // ERROR
46 class baz { } // ERROR
47 }
48 }
50 void m4() {
51 class baz {
52 class baz { // ERROR
53 class baz { } // ERROR
54 }
55 }
56 }
58 class foo$bar {
59 class foo$bar { // ERROR
60 class foo { }
61 class bar { }
62 }
63 }
65 void m5() {
66 class foo$bar {
67 class foo$bar { // ERROR
68 class foo { }
69 class bar { }
70 }
71 }
72 }
74 class $bar {
75 class foo {
76 class $bar { } // ERROR
77 }
78 }
80 void m6() {
81 class $bar {
82 class foo {
83 class $bar { } // ERROR
84 }
85 }
86 }
88 class bar$bar {
89 class bar {
90 class bar{ } // ERROR
91 }
92 }
94 void m7() {
95 class bar$bar {
96 class bar {
97 class bar{ } // ERROR
98 }
99 }
100 }
102 // The name of the class below clashes with the name of the
103 // class created above for 'class foo { class foo {} }'.
104 // The clash follows from the naming requirements of the inner
105 // classes spec, but is most likely a specification bug.
107 // Error may be reported here. See 4278961.
108 // As of Merlin-beta b21, this now results in an error.
109 class foo$foo { } // ERROR
111 }