author | jjg |
Thu, 10 Jul 2008 11:25:23 -0700 | |
changeset 863 | 3113c955a388 |
parent 10 | 06bc494ca11e |
child 6150 | d055fa8ced62 |
permissions | -rw-r--r-- |
10 | 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 |
* |
|
863
3113c955a388
6724327: eliminate use of shell tests for simple golden file tests
jjg
parents:
10
diff
changeset
|
7 |
* @compile/fail/ref=NestedInnerClassNames.out -XDrawDiagnostics -XDstdout NestedInnerClassNames.java |
10 | 8 |
*/ |
9 |
||
10 |
/* |
|
11 |
* This program should compile with errors as marked. |
|
12 |
*/ |
|
13 |
||
14 |
public class NestedInnerClassNames { |
|
15 |
||
16 |
class NestedInnerClassNames {} // ERROR |
|
17 |
||
18 |
void m1() { |
|
19 |
class NestedInnerClassNames {} // ERROR |
|
20 |
} |
|
21 |
||
22 |
class foo { |
|
23 |
class foo { } // ERROR |
|
24 |
} |
|
25 |
||
26 |
void m2 () { |
|
27 |
class foo { |
|
28 |
class foo { } // ERROR |
|
29 |
} |
|
30 |
} |
|
31 |
||
32 |
class bar { |
|
33 |
class foo { } |
|
34 |
class NestedInnerClassNames {} // ERROR |
|
35 |
} |
|
36 |
||
37 |
void m3() { |
|
38 |
class bar { |
|
39 |
class foo { } |
|
40 |
class NestedInnerClassNames {} // ERROR |
|
41 |
} |
|
42 |
} |
|
43 |
||
44 |
class baz { |
|
45 |
class baz { // ERROR |
|
46 |
class baz { } // ERROR |
|
47 |
} |
|
48 |
} |
|
49 |
||
50 |
void m4() { |
|
51 |
class baz { |
|
52 |
class baz { // ERROR |
|
53 |
class baz { } // ERROR |
|
54 |
} |
|
55 |
} |
|
56 |
} |
|
57 |
||
58 |
class foo$bar { |
|
59 |
class foo$bar { // ERROR |
|
60 |
class foo { } |
|
61 |
class bar { } |
|
62 |
} |
|
63 |
} |
|
64 |
||
65 |
void m5() { |
|
66 |
class foo$bar { |
|
67 |
class foo$bar { // ERROR |
|
68 |
class foo { } |
|
69 |
class bar { } |
|
70 |
} |
|
71 |
} |
|
72 |
} |
|
73 |
||
74 |
class $bar { |
|
75 |
class foo { |
|
76 |
class $bar { } // ERROR |
|
77 |
} |
|
78 |
} |
|
79 |
||
80 |
void m6() { |
|
81 |
class $bar { |
|
82 |
class foo { |
|
83 |
class $bar { } // ERROR |
|
84 |
} |
|
85 |
} |
|
86 |
} |
|
87 |
||
88 |
class bar$bar { |
|
89 |
class bar { |
|
90 |
class bar{ } // ERROR |
|
91 |
} |
|
92 |
} |
|
93 |
||
94 |
void m7() { |
|
95 |
class bar$bar { |
|
96 |
class bar { |
|
97 |
class bar{ } // ERROR |
|
98 |
} |
|
99 |
} |
|
100 |
} |
|
101 |
||
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. |
|
106 |
||
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 |
|
110 |
||
111 |
} |