< prev index next >

test/tools/javac/TryWithResources/TwrForVariable2.java

Print this page




  10         TwrForVariable3[] v2 = new TwrForVariable3[1];
  11 
  12         try (final v) {
  13             fail("no modifiers before variables");
  14         }
  15         try (@Deprecated v) {
  16             fail("no annotations before variables");
  17         }
  18         try (v;;) {
  19             fail("illegal double semicolon");
  20         }
  21         try ((v)) {
  22             fail("parentheses not allowed");
  23         }
  24         try (v2[0]) {
  25             fail("array access not allowed");
  26         }
  27         try (args.length == 0 ? v : v) {
  28             fail("general expressions not allowed");
  29         }



  30     }
  31 
  32     static void fail(String reason) {
  33         throw new RuntimeException(reason);
  34     }
  35 
  36     public void close() {
  37     }
  38 
  39 }


  10         TwrForVariable3[] v2 = new TwrForVariable3[1];
  11 
  12         try (final v) {
  13             fail("no modifiers before variables");
  14         }
  15         try (@Deprecated v) {
  16             fail("no annotations before variables");
  17         }
  18         try (v;;) {
  19             fail("illegal double semicolon");
  20         }
  21         try ((v)) {
  22             fail("parentheses not allowed");
  23         }
  24         try (v2[0]) {
  25             fail("array access not allowed");
  26         }
  27         try (args.length == 0 ? v : v) {
  28             fail("general expressions not allowed");
  29         }
  30         try ((TwrForVariable2)null) {
  31             fail("null as variable is not allowed");
  32         }
  33     }
  34 
  35     static void fail(String reason) {
  36         throw new RuntimeException(reason);
  37     }
  38 
  39     public void close() {
  40     }
  41 
  42 }
< prev index next >