-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
None
-
5.0
-
generic
-
generic
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
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
- relates to
-
JDK-6711619 javac doesn't allow access to protected members in intersection types
- Closed