equal
deleted
inserted
replaced
|
1 /* |
|
2 * @test /nodynamiccopyright/ |
|
3 * @bug 8231827 |
|
4 * @summary Clashing bindings are reported correctly |
|
5 * @compile/fail/ref=BindingsExistTest.out -XDrawDiagnostics --enable-preview -source ${jdk.version} BindingsExistTest.java |
|
6 */ |
|
7 public class BindingsExistTest { |
|
8 public void t(Object o1, Object o2) { |
|
9 if (o1 instanceof String k && o2 instanceof Integer k) {} |
|
10 |
|
11 if (o1 instanceof String k || o2 instanceof Integer k) {} |
|
12 |
|
13 if (!(o1 instanceof String k)) { |
|
14 return ; |
|
15 } |
|
16 if (o1 instanceof Integer k) {} |
|
17 |
|
18 String s2 = ""; |
|
19 if (o1 instanceof String s2) {} |
|
20 |
|
21 if (o1 instanceof String s3) { |
|
22 String s3 = ""; |
|
23 } |
|
24 |
|
25 if (!(o1 instanceof String s4)) { |
|
26 return ; |
|
27 } |
|
28 String s4 = ""; |
|
29 } |
|
30 } |