test/tools/javac/TryWithResources/ImplicitFinal.java

Wed, 01 Dec 2010 11:02:38 -0800

author
bpatel
date
Wed, 01 Dec 2010 11:02:38 -0800
changeset 766
90af8d87741f
parent 609
13354e1abba7
child 840
7f8794f9cc14
permissions
-rw-r--r--

6851834: Javadoc doclet needs a structured approach to generate the output HTML.
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 }

mercurial