--- /dev/null 2009-07-06 20:02:10.000000000 -0700 +++ new/test/tools/javac/AutomaticResourceManagement/WeirdArm.java 2010-07-04 10:48:22.000000000 -0700 @@ -0,0 +1,25 @@ +/* + * @test /nodynamiccopyright/ + * @bug 6911256 6964740 + * @author Joseph D. Darcy + * @summary Strange ARMs + * @compile/fail -source 6 WeirdArm.java + * @compile WeirdArm.java + * @run main WeirdArm + */ + +public class WeirdArm implements AutoCloseable { + private static int closeCount = 0; + public static void main(String... args) { + try(WeirdArm r1 = new WeirdArm(); WeirdArm r2 = r1) { + if (r1 != r2) + throw new RuntimeException("Unexpected inequality."); + } + if (closeCount != 2) + throw new RuntimeException("bad closeCount" + closeCount); + } + + public void close() { + closeCount++; + } +}