Files
codeql/java/ql/test/query-tests/LabelInSwitch/Test.java

22 lines
646 B
Java

public class Test {
void test_case_label_only_in_switch(int p) {
switch (p) {
case 1:
case 2:
break;
}
notcaselabelnotinswitch: for (;;) {}
}
void test_noncase_label_in_switch(int p) {
switch (p) {
case 1:
notcaselabel1:; // $ Alert | Possibly erroneous non-case label in switch statement. The case keyword might be missing.
break;
case 2:
notcaselabel2: for (;;) { break notcaselabel2; } // $ Alert | Confusing non-case label in switch statement.
break;
}
}
}