Community
Participate
Working Groups
If I access a class member of an invisible class (other package, class has package private access), I get an error, which is ok. But the error says, that the class does not exists, instead of telling me, that the class is just not accessable. See this code: --- in package pkgB --- package pkgB; // class with package private access class B { public static final String str = "string in invisible class"; } --- in package pkgA --- package pkgA; import pkgB.*; // referencing package of invisible class B public class A { public void f() { B b = new B(); // correct msg: "The type B is not visible" String s1 = b.str; // no error at all String s2 = B.str; // !!! wrong msg: "B cannot be resolved" } } From this behaviour follows, that I am not able to correct the line of String s2 by "Change visibility of 'B' to public". It may lead me to the false conclusion, that I have a typo in my java code. BTW: Sun's javac (SDK 1.5) tells me the right thing: src/pkgA/A.java:9: pkgB.B is not public in pkgB; cannot be accessed from outside package String s2 = B.str;
This is a JDT bug so transferring to the JDT Team.
Kent - I would consider this fix for 3.1.1 if low risk.
Added LookupTest test055 Released into HEAD and 3.1.2 stream
Verified for 3.2M4 in I20051212-2000
Verified for 3.1.2 using build M20060109-1200.