608N/A/*
608N/A * @test /nodynamiccopyright/
608N/A * @bug 6911256 6964740 6965277
608N/A * @author Maurizio Cimadamore
608N/A * @summary Check that resource variable is not accessible from catch/finally clause
608N/A * @compile/fail/ref=ResourceOutsideTry.out -XDrawDiagnostics ResourceOutsideTry.java
608N/A */
608N/A
608N/Aclass ResourceOutsideTry {
608N/A void test() {
608N/A try(MyResource c = new MyResource()) {
608N/A //do something
608N/A } catch (Exception e) {
608N/A c.test();
608N/A } finally {
608N/A c.test();
608N/A }
608N/A }
608N/A static class MyResource implements AutoCloseable {
608N/A public void close() throws Exception {}
608N/A void test() {}
608N/A }
608N/A}