2019-11-27 09:00:01 +01:00
|
|
|
/*
|
2020-12-30 17:20:54 +00:00
|
|
|
* @test /nodynamiccopyright/
|
2019-11-27 09:00:01 +01:00
|
|
|
* @bug 8231827
|
|
|
|
* @summary Match which involves a cast conversion
|
2020-11-05 08:01:33 +00:00
|
|
|
* @compile/fail/ref=CastConversionMatch.out -XDrawDiagnostics CastConversionMatch.java
|
2024-01-31 14:18:13 +00:00
|
|
|
* @compile --enable-preview --source ${jdk.version} CastConversionMatch.java */
|
2019-11-27 09:00:01 +01:00
|
|
|
|
|
|
|
public class CastConversionMatch {
|
2023-01-17 04:43:40 +00:00
|
|
|
public static void meth() {
|
2019-11-27 09:00:01 +01:00
|
|
|
Object o = 42;
|
|
|
|
if (o instanceof int s) {
|
|
|
|
System.out.println("Okay");
|
|
|
|
} else {
|
|
|
|
throw new AssertionError("broken");
|
|
|
|
}
|
|
|
|
System.out.println(">Test complete");
|
|
|
|
}
|
|
|
|
}
|