Thu, 07 Jun 2012 20:30:57 -0700
7170079: Adjustments to build-infra makefiles
Reviewed-by: ohair, ohrstrom, ihse, jonas
Contributed-by: jonas <jonas.oreland@oracle.com>, erikj <erik.joelsson@oracle.com>, ihse <magnus.ihse.bursie@oracle.com>, tgranat <torbjorn.granat@oracle.com>, ykantser <yekaterina.kantserova@oracle.com>
darcy@609 | 1 | /* |
darcy@609 | 2 | * @test /nodynamiccopyright/ |
darcy@840 | 3 | * @bug 6911256 6964740 6965277 7013420 |
darcy@609 | 4 | * @author Maurizio Cimadamore |
darcy@609 | 5 | * @summary Test that resource variables are implicitly final |
darcy@609 | 6 | * @compile/fail/ref=ImplicitFinal.out -XDrawDiagnostics ImplicitFinal.java |
darcy@609 | 7 | */ |
darcy@609 | 8 | |
darcy@609 | 9 | import java.io.IOException; |
darcy@609 | 10 | |
darcy@609 | 11 | class ImplicitFinal implements AutoCloseable { |
darcy@609 | 12 | public static void main(String... args) { |
darcy@609 | 13 | try(ImplicitFinal r = new ImplicitFinal()) { |
darcy@609 | 14 | r = null; //disallowed |
darcy@609 | 15 | } catch (IOException ioe) { // Not reachable |
darcy@609 | 16 | throw new AssertionError("Shouldn't reach here", ioe); |
darcy@609 | 17 | } |
darcy@840 | 18 | |
darcy@840 | 19 | try(@SuppressWarnings("unchecked") ImplicitFinal r1 = new ImplicitFinal()) { |
darcy@840 | 20 | r1 = null; //disallowed |
darcy@840 | 21 | } catch (IOException ioe) { // Not reachable |
darcy@840 | 22 | throw new AssertionError("Shouldn't reach here", ioe); |
darcy@840 | 23 | } |
darcy@840 | 24 | |
darcy@840 | 25 | try(final ImplicitFinal r2 = new ImplicitFinal()) { |
darcy@840 | 26 | r2 = null; //disallowed |
darcy@840 | 27 | } catch (IOException ioe) { // Not reachable |
darcy@840 | 28 | throw new AssertionError("Shouldn't reach here", ioe); |
darcy@840 | 29 | } |
darcy@840 | 30 | |
darcy@840 | 31 | try(final @SuppressWarnings("unchecked") ImplicitFinal r3 = new ImplicitFinal()) { |
darcy@840 | 32 | r3 = null; //disallowed |
darcy@840 | 33 | } catch (IOException ioe) { // Not reachable |
darcy@840 | 34 | throw new AssertionError("Shouldn't reach here", ioe); |
darcy@840 | 35 | } |
darcy@609 | 36 | } |
darcy@609 | 37 | public void close() throws IOException { |
darcy@609 | 38 | throw new IOException(); |
darcy@609 | 39 | } |
darcy@609 | 40 | } |