-
Bug
-
Resolution: Fixed
-
P3
-
1.1.4, 1.2.0
-
1.2beta2
-
unknown, x86, sparc
-
solaris_2.5, solaris_2.5.1, windows_nt
-
Not verified
Protected inner classes are available at all points in the immediate body
of any subclass of the protecting (i.e., enclosing) class. However, the
compiler rejects an attempted reference to a protected inherited class
if the reference occurs as a supertype of a further inner class.
(Note: This bug is masked when the two classes are in the same package,
because the compiler allows the reference on different grounds.)
Here is an example:
==> B.java <==
package b;
public class B {
protected class M { }
}
==> C.java <==
package c;
import b.B;
class C extends B {
M m; // OK
class N extends M { } // BAD
}
The output is:
C.java:5: Can't access inner class b.B. M. Only public classes and interfaces in other packages can be accessed.
class N extends M { } // BAD
^
1 error
--------
This problem is seen again in JDK1.2FCS-B build from /usr/local/java/jdk1.2fcs.
These files compiled fine with JDK1.2beta4-K build.
Compiling B.java and C.java throws the following error.
C.java:5: The type b.B.M to which the member <init> belongs is not accessible from inner class c.C. N.
class N extends M { } // BAD
^
1 error
Note : This scenario is used in one of the Accessibility tools used for testing JDK1.2 build. Hence the tools are not testable with JDK1.2FCS-B build. They compiled fine with JDK1.2beta4-K build.
mukund.madhugiri@eng 1998-07-20
of any subclass of the protecting (i.e., enclosing) class. However, the
compiler rejects an attempted reference to a protected inherited class
if the reference occurs as a supertype of a further inner class.
(Note: This bug is masked when the two classes are in the same package,
because the compiler allows the reference on different grounds.)
Here is an example:
==> B.java <==
package b;
public class B {
protected class M { }
}
==> C.java <==
package c;
import b.B;
class C extends B {
M m; // OK
class N extends M { } // BAD
}
The output is:
C.java:5: Can't access inner class b.B. M. Only public classes and interfaces in other packages can be accessed.
class N extends M { } // BAD
^
1 error
--------
This problem is seen again in JDK1.2FCS-B build from /usr/local/java/jdk1.2fcs.
These files compiled fine with JDK1.2beta4-K build.
Compiling B.java and C.java throws the following error.
C.java:5: The type b.B.M to which the member <init> belongs is not accessible from inner class c.C. N.
class N extends M { } // BAD
^
1 error
Note : This scenario is used in one of the Accessibility tools used for testing JDK1.2 build. Hence the tools are not testable with JDK1.2FCS-B build. They compiled fine with JDK1.2beta4-K build.
mukund.madhugiri@eng 1998-07-20
- duplicates
-
JDK-4085837 Protected inner class is inaccessible from another package
-
- Closed
-
-
JDK-4090645 BasicListUI.InputListener can't be extended
-
- Closed
-
- relates to
-
JDK-4151532 Bogus compiler error when extending BaiscListUI.InputListener
-
- Closed
-