--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/TryWithResources/ResDeclOutsideTry.java Wed Nov 13 16:36:08 2013 -0800
@@ -0,0 +1,18 @@
+/*
+ * @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;) {
+ }
+ }
+}
+