Bug 69587 - Package and variable name confuses compiler
Summary: Package and variable name confuses compiler
Status: RESOLVED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.0   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-07-08 06:55 EDT by Frank Jensen CLA
Modified: 2004-10-27 06:53 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Jensen CLA 2004-07-08 06:55:27 EDT
An example

package a;
class B {
}
---------------
package a;
class C {
public static void foo(){}
}
--------------
import a;
B a;
a.C.foo();//gives compile error
--------------
Comment 1 Adam Kiezun CLA 2004-07-08 09:43:05 EDT
compiler is rigth, as far as i know the spec:
section 6.3.2
http://java.sun.com/docs/books/jls/second_edition/html/names.doc.html#104058

"A simple name may occur in contexts where it may potentially be interpreted as 
the name of a variable, a type or a package. In these situations, the rules of 
ยง6.5 specify that a variable will be chosen in preference to a type, and that a 
type will be chosen in preference to a package. Thus, it is may sometimes be 
impossible to refer to a visible type or package declaration via its simple 
name. We say that such a declaration is obscured."
Comment 2 Philipe Mulet CLA 2004-07-08 10:01:05 EDT
This is indeed expected behavior.