langtools/test/tools/javac/nested/5009484/X.java
author sogoel
Wed, 02 Jul 2014 14:27:10 -0700
changeset 25310 a2e7f254f886
parent 5520 86e4b9a9da40
permissions -rw-r--r--
8046770: .out files for assert, boxing, and overload tests in tools/javac dir 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();
   }
}