test/tools/javac/TryWithResources/BadTwrSyntax.java

Print this page

        

*** 8,18 **** */ import java.io.IOException; public class BadTwrSyntax implements AutoCloseable { public static void main(String... args) throws Exception { ! // illegal semicolon ending resources try(BadTwr twrflow = new BadTwr();) { System.out.println(twrflow.toString()); } } --- 8,23 ---- */ import java.io.IOException; public class BadTwrSyntax implements AutoCloseable { public static void main(String... args) throws Exception { ! // illegal double semicolon ending resources ! try(BadTwr twrflow = new BadTwr();;) { ! System.out.println(twrflow.toString()); ! } ! ! // but one semicolon is fine try(BadTwr twrflow = new BadTwr();) { System.out.println(twrflow.toString()); } }