1 /*
   2  * @test  /nodynamiccopyright/
   3  * @bug 6911256 6964740 7013420
   4  * @author Joseph D. Darcy
   5  * @summary Verify invalid TWR block is not accepted.
   6  * @compile/fail/ref=TwrOnNonResource.out -XDrawDiagnostics TwrOnNonResource.java
   7  */
   8 
   9 class TwrOnNonResource {
  10     public static void main(String... args) {
  11         try(TwrOnNonResource aonr = new TwrOnNonResource()) {
  12             System.out.println(aonr.toString());
  13         }
  14         try(TwrOnNonResource aonr = new TwrOnNonResource()) {
  15             System.out.println(aonr.toString());
  16         } finally {;}
  17         try(TwrOnNonResource aonr = new TwrOnNonResource()) {
  18             System.out.println(aonr.toString());
  19         } catch (Exception e) {;}
  20     }
  21 
  22     /*
  23      * A close method, but the class is <em>not</em> Closeable or
  24      * AutoCloseable.
  25      */
  26     public void close() {
  27         throw new AssertionError("I'm not Closable!");
  28     }
  29 }