Files
Andrey.Cherkasov bb71856ac0 [java-highlighting] It is a compile-time error if a when expression is a constant expression with the value 'false'
IDEA-301355

GitOrigin-RevId: a67f6921d44d0acf8c8bdf1d42927d7c8ff42e1e
2022-09-08 14:33:42 +00:00

11 lines
467 B
Java

public class Main {
void foo(Object obj) {
final boolean flag = false;
switch (obj) {
case String s when <error descr="This case label has a guard that is a constant expression with value 'false'">false</error> -> {}
case String s when s.length() < 0 -> {}
case String s when <error descr="This case label has a guard that is a constant expression with value 'false'">((flag || flag)) && 1 < 0</error> -> {}
default -> {}
}
}
}