test/tools/javac/TryWithResources/BadTwr.java

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

author
mcimadamore
date
Thu, 21 Feb 2013 15:26:46 +0000
changeset 1599
9f0ec00514b6
parent 0
959103a6100f
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

     1 /*
     2  * @test  /nodynamiccopyright/
     3  * @bug 6911256 6964740
     4  * @author Joseph D. Darcy
     5  * @summary Verify bad TWRs don't compile
     6  * @compile/fail -source 6 TwrFlow.java
     7  * @compile/fail/ref=BadTwr.out -XDrawDiagnostics BadTwr.java
     8  */
    10 public class BadTwr implements AutoCloseable {
    11     public static void main(String... args) {
    12         // illegal repeated name
    13         try(BadTwr r1 = new BadTwr(); BadTwr r1 = new BadTwr()) {
    14             System.out.println(r1.toString());
    15         }
    17         // illegal duplicate name of method argument
    18         try(BadTwr args = new BadTwr()) {
    19             System.out.println(args.toString());
    20             final BadTwr thatsIt = new BadTwr();
    21             thatsIt = null;
    22         }
    24         try(BadTwr name = new BadTwr()) {
    25             // illegal duplicate name of enclosing try
    26             try(BadTwr name = new BadTwr()) {
    27                 System.out.println(name.toString());
    28             }
    29         }
    31     }
    33     public void close() {
    34         ;
    35     }
    36 }

mercurial