Bug 51029 - Editor cannot resolve type declared in differently named source file
Summary: Editor cannot resolve type declared in differently named source file
Status: RESOLVED DUPLICATE of bug 36032
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-02-01 13:09 EST by Bart Jacobs CLA
Modified: 2004-02-04 07:26 EST (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 Bart Jacobs CLA 2004-02-01 13:09:04 EST
The Java editor cannot resolve a type declared in a source file whose name is 
different from the name of the type, even though the project builds without 
errors and all types are displayed correctly in the Package Explorer and the 
Outline.

For example, consider the following project:

Test1.java

package test;

class Test1 {}
class Test1Too {}

Test2.java

package test;

class Test2 {
    Test1Too testField;
    ~~~~~~~~ Test1Too cannot be resolved (or is not a valid type) ...
}

The editor displays an error annotation and the Open Declaration command in 
the popup menu fails with the error message "Current text selection doesn't 
resolve to a Java element" in the status bar.

Workaround: Declare all types in separate source files.
Comment 1 Dani Megert CLA 2004-02-03 09:06:09 EST
Works for me using I20040130 and 2.1.2 (tested with auto-build on and off).
Did you save?
If you still see this please check whether there's an error in .log
Comment 2 Bart Jacobs CLA 2004-02-04 05:32:54 EST
In 3.0M6, this behavior seems to depend on whether the source file that declares
the type is opened in the editor or not. So, the refined bug report is as
follows: The editor cannot resolve a type declared in a source file whose name
is different from that of the type, unless the source file is currently being
edited.

For example, in the aforementioned example, close the editor for Test1.java and
an error annotation will appear in the editor for Test2.java.
Comment 3 Dani Megert CLA 2004-02-04 07:09:58 EST
This seem to be a Java Core problem. The same happens when auto-build is on and
the file is closed.
Comment 4 Jerome Lanneluc CLA 2004-02-04 07:26:44 EST

*** This bug has been marked as a duplicate of 36032 ***