1 /*
   2  * @test  /nodynamiccopyright/
   3  * @bug 6911256 6964740
   4  * @author Joseph D. Darcy
   5  * @summary Strange ARMs 
   6  * @compile/fail -source 6 WeirdArm.java
   7  * @compile WeirdArm.java
   8  * @run main WeirdArm
   9  */
  10 
  11 public class WeirdArm implements AutoCloseable {
  12     private static int closeCount = 0;
  13     public static void main(String... args) {
  14         try(WeirdArm r1 = new WeirdArm(); WeirdArm r2 = r1) {
  15             if (r1 != r2)
  16                 throw new RuntimeException("Unexpected inequality.");
  17         }
  18         if (closeCount != 2)
  19             throw new RuntimeException("bad closeCount" + closeCount);
  20     }
  21 
  22     public void close() {
  23         closeCount++;
  24     }
  25 }