1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
import org.checkerframework.checker.fenum.qual.Fenum;
class TestSwitch {
void m() {
@SuppressWarnings("fenum:assignment.type.incompatible")
@Fenum("TEST") final int annotated = 3;
@SuppressWarnings("fenum:assignment.type.incompatible")
@Fenum("TEST") final int annotated2 = 6;
int plain = 9; // FenumUnqualified
switch (plain) {
// :: error: (switch.type.incompatible)
case annotated:
default:
}
// un-annotated still working
switch (plain) {
case 1:
case 2:
default:
}
switch (annotated) {
// :: error: (switch.type.incompatible)
case 45:
default:
}
// annotated working
switch (annotated) {
case annotated2:
default:
}
}
}
|