10
|
1 |
/*
|
|
2 |
* @test /nodynamiccopyright/
|
|
3 |
* @bug 4074421 4277278 4785453
|
|
4 |
* @summary Verify that a local class cannot be redefined within its scope.
|
|
5 |
* @author William Maddox (maddox)
|
|
6 |
*
|
6150
|
7 |
* @compile/fail/ref=LocalClasses_2.out -XDrawDiagnostics LocalClasses_2.java
|
10
|
8 |
*/
|
|
9 |
|
|
10 |
class LocalClasses_2 {
|
|
11 |
|
|
12 |
void foo() {
|
|
13 |
class Local { }
|
|
14 |
{
|
|
15 |
class Local { } // ERROR
|
|
16 |
}
|
|
17 |
}
|
|
18 |
|
|
19 |
void bar() {
|
|
20 |
|
|
21 |
class Local { }
|
|
22 |
|
|
23 |
class Baz {
|
|
24 |
void quux() {
|
|
25 |
class Local { } // OK
|
|
26 |
}
|
|
27 |
}
|
|
28 |
|
|
29 |
class Quux {
|
|
30 |
void baz() {
|
|
31 |
class Random {
|
|
32 |
void quem() {
|
|
33 |
class Local { } // OK
|
|
34 |
}
|
|
35 |
}
|
|
36 |
}
|
|
37 |
}
|
|
38 |
}
|
|
39 |
}
|