Community
Participate
Working Groups
Created attachment 105311 [details] sample source code to reproduce the bug The Eclipse built-in Java compiler fails to report an error if the type is private. This is inconsistent with the Sun javac 1.6.0_06 compiler. See the attached source code for an example. Try it in Eclipse, and then from the command line. Eclipse reports no errors, but javac reports this error. Superclass.java:5: Subclass.NestedSubclass has private access in Subclass class Subclass extends Superclass<Subclass.NestedSubclass> { ^ 1 error
Reproduced in latest, with corrected testcase: public class X<T> { } class Subclass extends X<Subclass.NestedSubclass> { @SuppressWarnings("unchecked") private final class NestedSubclass extends X { } } Both java6 and 7 do complain.
Feels strange than an access to a private type be forbidden within enclosing type... like this code doesn't raise any error: public class X<T> { } class Subclass extends X<Object> { Subclass.NestedSubclass nested; @SuppressWarnings("unchecked") private final class NestedSubclass extends X { } } Feels like a javac bug to me.
See also bug 185422.
Indeed, this is a dup. *** This bug has been marked as a duplicate of bug 185422 ***