author | sogoel |
Wed, 02 Jul 2014 12:04:04 -0700 | |
changeset 25308 | 190cac01c316 |
parent 5520 | 86e4b9a9da40 |
permissions | -rw-r--r-- |
10 | 1 |
/* |
25308
190cac01c316
8044236: create .out files for DefiniteAssignment tests in tools/javac dir
sogoel
parents:
5520
diff
changeset
|
2 |
* @test /nodynamiccopyright/ |
10 | 3 |
* @bug 4695463 |
4 |
* @summary DA versus switch: javac allows reference to uninitialized variable |
|
5 |
* @author Neal Gafter (gafter) |
|
6 |
* |
|
25308
190cac01c316
8044236: create .out files for DefiniteAssignment tests in tools/javac dir
sogoel
parents:
5520
diff
changeset
|
7 |
* @compile/fail/ref=DASwitch.out -XDrawDiagnostics DASwitch.java |
10 | 8 |
*/ |
9 |
||
10 |
public class DASwitch { |
|
11 |
public static void main(final String[] args) { |
|
12 |
int t = 1; |
|
13 |
{ |
|
14 |
final int x; |
|
15 |
x = 1; |
|
16 |
} |
|
17 |
switch(t) { |
|
18 |
case 0: |
|
19 |
Integer b; |
|
20 |
break; |
|
21 |
case 1: |
|
22 |
System.out.println(b.toString()); |
|
23 |
} |
|
24 |
} |
|
25 |
} |