< prev index next >

test/langtools/tools/javac/TryWithResources/TwrVarRedeclaration.java

Print this page

 1 /*
 2  * @test /nodynamiccopyright/
 3  * @bug 7196163
 4  * @summary Variable redeclaration inside twr block
 5  * @compile/fail/ref=TwrVarRedeclaration.out -XDrawDiagnostics TwrVarRedeclaration.java
 6  */
 7 
 8 public class TwrVarRedeclaration implements AutoCloseable {
 9 
10     public static void main(String... args) {
11         TwrVarRedeclaration r = new TwrVarRedeclaration();
12 
13         try (r) {
14             TwrVarRedeclaration r = new TwrVarRedeclaration();
15         }
16 
17         try (r) {
18             Object r = new Object();
19         }
20 
21         try (r) {
22         } catch (Exception e) {
23             Exception r = new Exception();
24         }
25     }
26 
27     public void close() {}
28 }

 1 /*
 2  * @test /nodynamiccopyright/
 3  * @bug 7196163
 4  * @summary Variable redeclaration inside twr block
 5  * @compile/fail/ref=TwrVarRedeclaration.out -XDrawDiagnostics TwrVarRedeclaration.java
 6  */
 7 
 8 public class TwrVarRedeclaration implements AutoCloseable {
 9 
10     public static void main(String... args) {
11         TwrVarRedeclaration r = new TwrVarRedeclaration();
12 
13         try (r) {
14             TwrVarRedeclaration r = new TwrVarRedeclaration();
15         }
16 
17         try (r) {
18             Object r = new Object() {};
19         }
20 
21         try (r) {
22         } catch (Exception e) {
23             Exception r = new Exception();
24         }
25     }
26 
27     public void close() {}
28 }
< prev index next >