The name of the collision between the package and the class. Error in Eclipse or javac?

For this source code ...

enter image description here

... Eclipse reports the following error:

Only type can be imported. pkg.a permits the package

... while Suns javaccompiles it.

A similar situation if I try to fully qualify the class pkg.aas follows:

enter image description here

Eclipse Reports ...

pkg.a cannot be allowed for type

... while Suns javaccompiles it.


It seems that Eclipse prefers to interpret the identifier as a package above the class name, while javac does the opposite. So, is this a bug in Eclipse or in javac?

(The reference to the language specification is obviously a plus.)

+5
source share
2 answers

This is definitely an Eclipse error:

6.4.2. Concealment

, , . 6.5 , . , . , .

, . JLS , , , ... , .


, , , , Java . ...

+3

, , ; .

+1

All Articles