equal
deleted
inserted
replaced
|
1 /* |
|
2 * @test /nodynamiccopyright/ |
|
3 * @bug 8231827 |
|
4 * @summary Ensure that in type test patterns, the predicate is not trivially provable false. |
|
5 * @compile/fail/ref=PatternVariablesAreFinal.out -XDrawDiagnostics --enable-preview -source ${jdk.version} PatternVariablesAreFinal.java |
|
6 */ |
|
7 public class PatternVariablesAreFinal { |
|
8 public static void main(String[] args) { |
|
9 Object o = 32; |
|
10 if (o instanceof String s) { |
|
11 s = "hello again"; |
|
12 System.out.println(s); |
|
13 } |
|
14 System.out.println("test complete"); |
|
15 } |
|
16 } |