1.1 --- a/test/tools/javac/TryWithResources/ImplicitFinal.java Mon Jan 24 16:38:56 2011 -0800 1.2 +++ b/test/tools/javac/TryWithResources/ImplicitFinal.java Tue Jan 25 17:02:56 2011 -0800 1.3 @@ -1,6 +1,6 @@ 1.4 /* 1.5 * @test /nodynamiccopyright/ 1.6 - * @bug 6911256 6964740 6965277 1.7 + * @bug 6911256 6964740 6965277 7013420 1.8 * @author Maurizio Cimadamore 1.9 * @summary Test that resource variables are implicitly final 1.10 * @compile/fail/ref=ImplicitFinal.out -XDrawDiagnostics ImplicitFinal.java 1.11 @@ -15,12 +15,25 @@ 1.12 } catch (IOException ioe) { // Not reachable 1.13 throw new AssertionError("Shouldn't reach here", ioe); 1.14 } 1.15 + 1.16 + try(@SuppressWarnings("unchecked") ImplicitFinal r1 = new ImplicitFinal()) { 1.17 + r1 = null; //disallowed 1.18 + } catch (IOException ioe) { // Not reachable 1.19 + throw new AssertionError("Shouldn't reach here", ioe); 1.20 + } 1.21 + 1.22 + try(final ImplicitFinal r2 = new ImplicitFinal()) { 1.23 + r2 = null; //disallowed 1.24 + } catch (IOException ioe) { // Not reachable 1.25 + throw new AssertionError("Shouldn't reach here", ioe); 1.26 + } 1.27 + 1.28 + try(final @SuppressWarnings("unchecked") ImplicitFinal r3 = new ImplicitFinal()) { 1.29 + r3 = null; //disallowed 1.30 + } catch (IOException ioe) { // Not reachable 1.31 + throw new AssertionError("Shouldn't reach here", ioe); 1.32 + } 1.33 } 1.34 - 1.35 - 1.36 - // A close method, but the class is <em>not</em> Closeable or 1.37 - // AutoCloseable. 1.38 - 1.39 public void close() throws IOException { 1.40 throw new IOException(); 1.41 }