jdk-24/test/langtools/tools/javac/DefiniteAssignment/DASwitch.java

26 lines
532 B
Java
Raw Normal View History

2007-12-01 00:00:00 +00:00
/*
* @test /nodynamiccopyright/
2007-12-01 00:00:00 +00:00
* @bug 4695463
* @summary DA versus switch: javac allows reference to uninitialized variable
* @author Neal Gafter (gafter)
*
* @compile/fail/ref=DASwitch.out -XDrawDiagnostics DASwitch.java
2007-12-01 00:00:00 +00:00
*/
public class DASwitch {
public static void meth() {
2007-12-01 00:00:00 +00:00
int t = 1;
{
final int x;
x = 1;
}
switch(t) {
case 0:
Integer b;
break;
case 1:
System.out.println(b.toString());
}
}
}