jdk-24/test/langtools/tools/javac/lint/FallThrough.java

25 lines
442 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 4821359 4981267
* @summary Add -Xlint flag
* @author gafter
*
* @compile/fail/ref=FallThrough.out -XDrawDiagnostics -Xlint:fallthrough -Werror FallThrough.java
2007-12-01 00:00:00 +00:00
*/
class FallThrough {
int x;
void f(int i) {
switch (i) {
case 0:
x = 0;
case 1:
case 2:
x = 2;
break;
default:
x = 3;
}
}
}