langtools/test/tools/javac/TryWithResources/T7022711.java
changeset 34565 627464b87753
parent 8620 0b04e5235f25
--- a/langtools/test/tools/javac/TryWithResources/T7022711.java	Tue Dec 08 21:02:07 2015 +0100
+++ b/langtools/test/tools/javac/TryWithResources/T7022711.java	Wed Dec 09 14:26:56 2015 +0100
@@ -9,12 +9,22 @@
 
 class T7022711 {
     public static void main (String args[]) throws Exception {
+        // declared resource
         try (DataInputStream is = new DataInputStream(new FileInputStream("x"))) {
             while (true) {
                 is.getChar();  // method not found
             }
         } catch (EOFException e) {
         }
+
+        // resource as variable
+        DataInputStream is = new DataInputStream(new FileInputStream("x"));
+        try (is) {
+            while (true) {
+                is.getChar();  // method not found
+            }
+        } catch (EOFException e) {
+        }
     }
 }