langtools/test/tools/javac/nested/5009484/X.java
author jlahoda
Thu, 09 Oct 2014 10:08:52 +0200
changeset 26993 513b2cae81c3
parent 25310 a2e7f254f886
permissions -rw-r--r--
8057652: Request to improve error messages for labeled declarations Summary: Parse labeled statements as block statements to improve error recovery for labeled declarations; related cleanup. Reviewed-by: jjg

/*
 * @test    /nodynamiccopyright/
 * @bug     5009484
 * @summary Compiler fails to resolve appropriate type for outer member
 * @author  Philippe P Mulet
 * @compile/fail/ref=X.out -XDrawDiagnostics  X.java
 */

public class X<T> {
   private T t;
   X(T t) {
       this.t = t;
   }
   public static void main(String[] args) {
       new X<String>("OUTER").bar();
   }
   void bar() {
       new X<X>(this) {     // #1
           void run() {
               new Object() {  // #2
                   void run() {
                       X x = t;        // #3 <--- which t is bound ?
                   System.out.println(x);
                   }
               }.run();
           }
       }.run();
   }
}