Community
Participate
Working Groups
Inner classes which are package protected are not properly recognized; an error inside eclipse is shown, but the compilation has no problems or warnings. Example: The following code is not properly recognized but compiles and works properly. --- Outer.java public class Outer { } class PackageProtected{ void print(){ System.out.println("print()"); } } --- SamePackage.java public class SamePackage { PackageProtected pp; public static void main(String[] args) { SamePackage sp = new SamePackage(); sp.pp = new PackageProtected(); sp.pp.print(); } }
Actually, not inner classes, but package protected classes which are inside another class' file. Big difference.
Moving to JDT-UI.
Philippe, any comments.
This is a known issue with secondary types which aren't properly detected in the Java model resolution. The compiler usually will find them better since all types are fed to the compiler at once, but it can occur that compilation would fail as well, though the case is not so common. Workaround is to extract secondary type in separate file with proper name. We want to support this scenario in the future though.
*** This bug has been marked as a duplicate of 36032 ***