test/tools/javac/TryWithResources/BadTwrSyntax.java

Thu, 21 Feb 2013 15:26:46 +0000

author
mcimadamore
date
Thu, 21 Feb 2013 15:26:46 +0000
changeset 1599
9f0ec00514b6
parent 850
2ab47c4cd618
child 2525
2eb010b6cb22
permissions
-rw-r--r--

8007461: Regression: bad overload resolution when inner class and outer class have method with same name
Summary: Fix regression in varargs method resolution introduced by bad refactoring
Reviewed-by: jjg

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

mercurial