langtools/test/tools/javac/TryWithResources/ResDeclOutsideTry.java
author sogoel
Thu, 05 Jun 2014 10:57:10 -0700
changeset 24797 850ebd4d80a7
parent 21714 f5b7edec4304
child 27844 8b5d79870a2f
permissions -rw-r--r--
8044072: Group 2: create .out files for OverrideChecks tests in tools/javac dir Reviewed-by: jjg

/*
 * @test  /nodynamiccopyright/
 * @bug 8025113
 * @author sogoel
 * @summary Resources cannot be declared outside t-w-r block
 * @compile/fail/ref=ResDeclOutsideTry.out -XDrawDiagnostics ResDeclOutsideTry.java
 */

public class ResDeclOutsideTry implements AutoCloseable {
    ResDeclOutsideTry tr1;
    ResDeclOutsideTry tr2 = new ResDeclOutsideTry();

    String test1() {
        try (tr1 = new ResDeclOutsideTry(); tr2;) {
        }
    }
}