/* * @test /nodynamiccopyright/ * @bug 6911256 6964740 6965277 * @author Joseph D. Darcy * @summary Verify nested ARM blocks have proper semantics * @compile/fail -source 6 NestedArm.java * @compile NestedArm.java * @run main NestedArm */ import java.io.IOException; public class NestedArm implements AutoCloseable { private final Class exceptionOnClose; public NestedArm(Class exception) { exceptionOnClose = exception; } public static void main(String... args) throws Exception { try(NestedArm armflow = new NestedArm(AnotherCustomCloseException.class)) { try(NestedArm armflow2 = new NestedArm(YetAnotherCustomCloseException.class)) { ; } } catch (AnotherCustomCloseException e) { e.printStackTrace(); } } /* * A close method. */ public void close() throws Exception { throw exceptionOnClose.newInstance(); } } class AnotherCustomCloseException extends Exception {} class YetAnotherCustomCloseException extends Exception {}