Fri, 12 Nov 2010 12:34:18 +0000
6970016: Clean up ARM/try-with-resources implementation
Summary: changed Xlint option name from -Xlint:arm to -Xlint:try
Reviewed-by: jjg
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 */
9 import java.io.IOException;
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 }
21 // A close method, but the class is <em>not</em> Closeable or
22 // AutoCloseable.
24 public void close() throws IOException {
25 throw new IOException();
26 }
27 }