mirror of
https://github.com/github/codeql.git
synced 2025-12-18 18:10:39 +01:00
24 lines
440 B
Java
24 lines
440 B
Java
public class TestSwitchExprStmtConsistency {
|
|
|
|
static int f() { return 0; }
|
|
|
|
public static void test(int x) {
|
|
|
|
// Test that getRuleExpression() and getRuleStatement() behave alike for switch expressions and statements using arrow rules.
|
|
|
|
switch(x) {
|
|
case 1 -> f();
|
|
case 2 -> f();
|
|
default -> f();
|
|
}
|
|
|
|
int result = switch(x) {
|
|
case 1 -> f();
|
|
case 2 -> f();
|
|
default -> f();
|
|
};
|
|
|
|
}
|
|
|
|
}
|