equal
deleted
inserted
replaced
|
1 /* |
|
2 * @test /nodynamiccopyright/ |
|
3 * @bug 8231827 |
|
4 * @summary Basic pattern bindings scope test |
|
5 * @compile/fail/ref=DuplicateBindingTest.out -XDrawDiagnostics --enable-preview -source ${jdk.version} DuplicateBindingTest.java |
|
6 */ |
|
7 |
|
8 public class DuplicateBindingTest { |
|
9 |
|
10 int f; |
|
11 |
|
12 public static void main(String[] args) { |
|
13 |
|
14 if (args != null) { |
|
15 int s; |
|
16 if (args[0] instanceof String s) { // NOT OK. Redef same scope. |
|
17 } |
|
18 if (args[0] instanceof String f) { // OK to redef field. |
|
19 } |
|
20 } |
|
21 } |
|
22 } |