JDK-6558551 : Type variables incorrectly inherits private members
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: generic
  • CPU: generic
  • Submitted: 2007-05-17
  • Updated: 2010-04-02
  • Resolved: 2009-03-13
Related Reports
Relates :  
Relates :  
Description
This is a javac bug.  A type variable should not "inherit" any private members.  This follows from 4.4 and 4.9.

-Neal

On 1/11/07, ... wrote:
Section 4.4 describes the members of type variables and the access to 
        them, including an example on page 50.  Based on that description, I
        would expect an access error on the reference to E.i, but this is
        accepted by javac.
        
        Did I overlook something in the JLS?  If not, is this a JLS error or 
        a javac bug?
        
        class X<E extends X<E>> {
                 private static int i;
                 int f() {
                         return E.i;
                 }
        }

Comments
EVALUATION Not reproducible after jdk 7 b40 (see 6711619)
13-03-2009