A test based on 4122297 has been added to the JCK. The test should
compile successfully, however it fails with the new compiler
(jdk1.3d). Since this problem was previously fixed in jdk1.2, the new
behaviour represents a regression.
lang/NAME/name007/name00705/name00705.html
The following is a simplification of that test:
FILE: PvtMbrsNotInherit1.java
public class PvtMbrsNotInherit extends OtherClass {
public static void main(String args[]) {
java.lang.Long.toString(0);
}
}
class OtherClass {
private int java;
}
OUTPUT:
$ java -fullversion
java full version "JDK-1.3-D"
$ javac PvtMbrsNotInherit1.java
PvtMbrsNotInherit1.java:3: variable java has private access in class OtherClass
java.lang.Long.toString(0);
^
PvtMbrsNotInherit1.java:3: int cannot be dereferenced
java.lang.Long.toString(0);
^
2 errors
iris.garcia@eng 1999-05-21
Name: ssC76496 Date: 07/28/99
Private members are not inherited from superclasses in JDK1.3-L build.
###@###.###, 28 Jun 99.
======================================================================
compile successfully, however it fails with the new compiler
(jdk1.3d). Since this problem was previously fixed in jdk1.2, the new
behaviour represents a regression.
lang/NAME/name007/name00705/name00705.html
The following is a simplification of that test:
FILE: PvtMbrsNotInherit1.java
public class PvtMbrsNotInherit extends OtherClass {
public static void main(String args[]) {
java.lang.Long.toString(0);
}
}
class OtherClass {
private int java;
}
OUTPUT:
$ java -fullversion
java full version "JDK-1.3-D"
$ javac PvtMbrsNotInherit1.java
PvtMbrsNotInherit1.java:3: variable java has private access in class OtherClass
java.lang.Long.toString(0);
^
PvtMbrsNotInherit1.java:3: int cannot be dereferenced
java.lang.Long.toString(0);
^
2 errors
iris.garcia@eng 1999-05-21
Name: ssC76496 Date: 07/28/99
Private members are not inherited from superclasses in JDK1.3-L build.
###@###.###, 28 Jun 99.
======================================================================
- duplicates
-
JDK-4249653 new javac assumes that private fields are inherited by a subclass
- Closed
-
JDK-4249122 New compiler incorrectly allows inheritance of private fields
- Closed
- relates to
-
JDK-4122297 javac's error messages are not appropriate for a private field.
- Closed