Bug 38088

Summary: package protected classes not recognized properly
Product: [Eclipse Project] JDT Reporter: Germano Leichsenring <gdumm>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P3    
Version: 2.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Germano Leichsenring CLA 2003-05-25 07:18:00 EDT
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();
	}
}
Comment 1 Germano Leichsenring CLA 2003-05-25 07:25:47 EDT
Actually, not inner classes, but package protected classes which are inside
another class' file. Big difference.
Comment 2 Rafael Chaves CLA 2003-05-26 10:02:59 EDT
Moving to JDT-UI.
Comment 3 Dirk Baeumer CLA 2003-05-26 14:21:57 EDT
Philippe, any comments.
Comment 4 Philipe Mulet CLA 2003-05-27 04:59:15 EDT
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.
Comment 5 Philipe Mulet CLA 2003-05-27 05:00:04 EDT

*** This bug has been marked as a duplicate of 36032 ***