1 /* 2 * @test /nodynamiccopyright/ 3 * @bug 6911256 6964740 6965277 4 * @author Maurizio Cimadamore 5 * @summary Test that resource variables are implicitly final 6 * @compile/fail/ref=ImplicitFinal.out -XDrawDiagnostics ImplicitFinal.java 7 */ 8 9 import java.io.IOException; 10 11 class ImplicitFinal implements AutoCloseable { 12 public static void main(String... args) { 13 try(ImplicitFinal r = new ImplicitFinal()) { 14 r = null; //disallowed 15 } catch (IOException ioe) { // Not reachable 16 throw new AssertionError("Shouldn't reach here", ioe); 17 } 18 } 19 20 21 // A close method, but the class is <em>not</em> Closeable or 22 // AutoCloseable. 23 24 public void close() throws IOException { 25 throw new IOException(); 26 } 27 }