langtools/test/tools/javac/TryWithResources/TwrVarRedeclaration.java
changeset 34565 627464b87753
equal deleted inserted replaced
34564:ce1498f6591f 34565:627464b87753
       
     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 }