/* * @test /nodynamiccopyright/ * @bug 6911256 6964740 * @author Joseph D. Darcy * @summary Test exception analysis of ARM blocks * @compile/fail/ref=TwrFlow.out -XDrawDiagnostics TwrFlow.java */importjava.io.IOException;publicclassTwrFlowimplementsAutoCloseable{publicstaticvoidmain(String...args){try(TwrFlowarmflow=newTwrFlow()){System.out.println(armflow.toString());}catch(IOExceptionioe){// Not reachablethrownewAssertionError("Shouldn't reach here",ioe);}// CustomCloseException should be caught or added to throws clause// Also check behavior on a resource expression rather than a// declaration.TwrFlowarmflowexpr=newTwrFlow();try(armflowexpr){System.out.println(armflowexpr.toString());}catch(IOExceptionioe){// Not reachablethrownewAssertionError("Shouldn't reach here",ioe);}// CustomCloseException should be caught or added to throws clause}/* * A close method, but the class is <em>not</em> Closeable or * AutoCloseable. */publicvoidclose()throwsCustomCloseException{thrownewCustomCloseException();}}classCustomCloseExceptionextendsException{}