Bug 106140 - [compiler] Eclipse3.1.0: unrecognized class invisibility
Summary: [compiler] Eclipse3.1.0: unrecognized class invisibility
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: 3.1.2   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-05 03:46 EDT by Michael Schneider CLA
Modified: 2006-01-10 07:28 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Schneider CLA 2005-08-05 03:46:59 EDT
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;
Comment 1 Helen Beeken CLA 2005-08-05 04:02:06 EDT
This is a JDT bug so transferring to the JDT Team.
Comment 2 Philipe Mulet CLA 2005-08-08 05:32:36 EDT
Kent - I would consider this fix for 3.1.1 if low risk.
Comment 3 Kent Johnson CLA 2005-11-14 17:25:55 EST
Added LookupTest test055

Released into HEAD and 3.1.2 stream
Comment 4 Olivier Thomann CLA 2005-12-13 10:01:08 EST
Verified for 3.2M4 in I20051212-2000
Comment 5 Frederic Fusier CLA 2006-01-10 07:28:47 EST
Verified for 3.1.2 using build M20060109-1200.