JDK-7012200 : generified code fails to compile
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 7
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_7
  • CPU: x86
  • Submitted: 2011-01-13
  • Updated: 2012-09-06
  • Resolved: 2011-01-13
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
$ java -version
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b119)
Java HotSpot(TM) 64-Bit Server VM (build 20.0-b03, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.1.7600]

A DESCRIPTION OF THE PROBLEM :
The attached source code fails to compile


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile said class fails

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
It should compile correctly

ERROR MESSAGES/STACK TRACES THAT OCCUR :
Wtf.java:[7,28] foo has private access in Wtf

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
public class Wtf {
    private Object foo;
    
    public <T extends Wtf> void test(T t) {
        System.out.println(t.foo);
    }
}
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
make the field package private