United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-6246814 : Private member of type variable wrongly accesible

Details
Type:
Bug
Submit Date:
2005-03-28
Status:
Closed
Updated Date:
2011-05-23
Project Name:
JDK
Resolved Date:
2009-01-21
Component:
tools
OS:
generic
Sub-Component:
javac
CPU:
generic
Priority:
P4
Resolution:
Cannot Reproduce
Affected Versions:
5.0
Fixed Versions:

Related Reports
Relates:

Sub Tasks

Description
This program compiles:

class T<X extends T<X>> {
    private int t = 123;
    {
        X x = null;
        x.t = 456; // X inherits private member t? Not according to JLS
    }
}

According to the JLS 4.4 (Type Variables) the members of
a type variable are the same as the intersection type 4.9
(Intersection Types), meaning that this is equivalent:

class T {
    private int t = 123;
    {
        class X extends T {}
        X x = null;
        x.t = 456;
    }
}

This program doesn't compile.

###@###.### 2005-03-28 19:33:39 GMT

                                    

Comments
EVALUATION

A bug.
                                     
2005-09-01
EVALUATION

This has been fixed by the fix of 6711619 in 7 b40
                                     
2009-01-21



Hardware and Software, Engineered to Work Together