1 /* 2 * @test /nodynamiccopyright/ 3 * @bug 6911256 6964740 4 * @author Joseph D. Darcy 5 * @summary Verify bad TWRs don't compile 6 * @compile/fail/ref=BadTwrSyntax.out -XDrawDiagnostics BadTwrSyntax.java 7 */ 8 9 import java.io.IOException; 10 public class BadTwrSyntax implements AutoCloseable { 11 public static void main(String... args) throws Exception { 12 // illegal double semicolon ending resources 13 try(BadTwr twrflow = new BadTwr();;) { 14 System.out.println(twrflow.toString()); 15 } 16 17 // but one semicolon is fine 18 try(BadTwr twrflow = new BadTwr();) { 19 System.out.println(twrflow.toString()); 20 } 21 } 22 23 public void close() { 24 ; 25 } 26 }