Bug 10460 - The Compiler can not resolve package level class
Summary: The Compiler can not resolve package level class
Status: RESOLVED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows XP
: P1 critical (vote)
Target Milestone: 2.0 M4   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-02-28 01:41 EST by Alex Kwan CLA
Modified: 2002-03-01 04:34 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 Alex Kwan CLA 2002-02-28 01:41:52 EST
If u create a class file named Test.java and the file only contains a package 
level class which name is "Test2". The when you use the class in the same 
package, the compiler will report "Test2 can not be resovle"
such as

in file Test.java

package mytest;

class Test2 {

}

int file Error.java
package mytest;
public class Error {
    public Error() {
        Test2 test2 = new Test2();//This line will trigger this bug
    }
}

When you compile Error.java, the compiler will report Test2 can not be resovle
Comment 1 Philipe Mulet CLA 2002-02-28 06:24:13 EST
If you compile Error.java with Test.java on its classpath, then no compiler 
will have the idea to investigate Test when searching for Test2.

Try it with command line compilers and you will see this happening. 

When using the Java builder, then a full build will throw both files in the 
compilation loop simultaneously, and then Test2 will be accessible. But if 
doing an incremental recompilation, then your code is depending on the fact 
that Test.java got processed before Error.java.

Basically, you should not use the secondary type Test2 outside of Test.java, if 
you do then you are exposed to those issues. Either define Test2 inside 
Test2.java or move Test2 definition to Error.java as a secondary type.