jdk-24/test/langtools/tools/javac/patterns/T8309054.java
Aggelos Biboudis 4f3a95af2f 8309054: Parsing of erroneous patterns succeeds
Reviewed-by: jlahoda
2023-05-31 09:37:58 +00:00

24 lines
634 B
Java

/**
* @test /nodynamiccopyright/
* @bug 8309054
* @summary Parsing of erroneous patterns succeeds
* @enablePreview
* @compile/fail/ref=T8309054.out -XDrawDiagnostics --should-stop=at=FLOW T8309054.java
*/
public class T8309054 {
public void test(Object obj) {
boolean t1 = switch (obj) {
case Long a[] -> true;
default -> false;
};
boolean t2 = switch (obj) {
case Double a[][][][] -> true;
default -> false;
};
if (obj instanceof Float a[][]) {
}
if (obj instanceof Integer a = Integer.valueOf(0)) {
}
}
}