author | hannesw |
Tue, 22 Mar 2016 14:23:16 +0100 | |
changeset 36690 | 06b714373aa4 |
parent 26662 | 7cf828d7c8fc |
permissions | -rw-r--r-- |
10 | 1 |
/* |
26662
7cf828d7c8fc
8055080: Group 9d: golden files for tests in tools/javac dir
sogoel
parents:
5520
diff
changeset
|
2 |
* @test /nodynamiccopyright/ |
10 | 3 |
* @bug 4725650 |
4 |
* @summary Restrict scope of local classes in switch-block-group |
|
5 |
* @author gafter |
|
6 |
* |
|
26662
7cf828d7c8fc
8055080: Group 9d: golden files for tests in tools/javac dir
sogoel
parents:
5520
diff
changeset
|
7 |
* @compile/fail/ref=SwitchScope.out -XDrawDiagnostics SwitchScope.java |
10 | 8 |
*/ |
9 |
||
10 |
public class SwitchScope { |
|
11 |
public static void main(String[] args) { |
|
12 |
switch (args.length) { |
|
13 |
case 0: |
|
14 |
final int k; |
|
15 |
k = 12; |
|
16 |
class Local { |
|
17 |
int j = k; |
|
18 |
} |
|
19 |
case 1: |
|
20 |
// the scope of a local class does not extend from one |
|
21 |
// switch case to the next. |
|
22 |
Object o = new Local(); |
|
23 |
} |
|
24 |
} |
|
25 |
} |