langtools/test/tools/javac/TryWithResources/TwrForVariable3.java
changeset 34565 627464b87753
parent 27844 8b5d79870a2f
equal deleted inserted replaced
34564:ce1498f6591f 34565:627464b87753
     5  */
     5  */
     6 public class TwrForVariable3 implements AutoCloseable {
     6 public class TwrForVariable3 implements AutoCloseable {
     7     public static void main(String... args) {
     7     public static void main(String... args) {
     8         TwrForVariable3 v1 = new TwrForVariable3();
     8         TwrForVariable3 v1 = new TwrForVariable3();
     9         Object v2 = new Object();
     9         Object v2 = new Object();
       
    10         Object v3 = new Object() {
       
    11             public void close() {
       
    12             }
       
    13         };
    10 
    14 
    11         try (v2) {
    15         try (v2) {
    12             fail("no an AutoCloseable");
    16             fail("not an AutoCloseable");
       
    17         }
       
    18         try (v3) {
       
    19             fail("not an AutoCloseable although has close() method");
    13         }
    20         }
    14         try (java.lang.Object) {
    21         try (java.lang.Object) {
    15             fail("not a variable access");
    22             fail("not a variable access");
    16         }
    23         }
    17         try (java.lang) {
    24         try (java.lang) {