mirror of
https://github.com/github/codeql.git
synced 2025-12-18 09:43:15 +01:00
30 lines
414 B
Java
30 lines
414 B
Java
public class GuardTest {
|
|
|
|
public static void sink(String s) { }
|
|
public static boolean isSafe(String s) { return s.length() < 10; }
|
|
|
|
public static void test(Object o) {
|
|
|
|
switch (o) {
|
|
|
|
case String s:
|
|
sink(s);
|
|
break;
|
|
default:
|
|
break;
|
|
|
|
}
|
|
|
|
switch (o) {
|
|
|
|
case String s when isSafe(s):
|
|
sink(s);
|
|
break;
|
|
default:
|
|
break;
|
|
|
|
}
|
|
}
|
|
|
|
}
|