-
Bug
-
Resolution: Won't Fix
-
P4
-
None
-
8u72
One licensee expected an exception IllegalAccessException when calling a
public method of nested protected class via reflection from outside package.
With attached test program, no such an exception was seen.
The test program has two nested classes in bar/Outer.java. One is static
nested class, the other is inner class(non-static). The modifiers of these
two nested classes are set protected.
The main program invoked public methods in these two nested classes through
reflection API, the expected exception did not occur.
Refer to JLS, 15.12.4.3. Check Accessibility of Type and Method
http://docs.oracle.com/javase/specs/jls/se8/html/jls-15.html#jls-15.12.4.3
Because the main class(foo/Tester.java) is not a subclass of bar/Outer.java,
it should not be accessible to methods of those nested protected classes.
Please check if it conforms to the specification.
- relates to
-
JDK-8255435 Improve JLS regarding access check for protected nested types
-
- Open
-