Community
Participate
Working Groups
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.
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
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.
This seem to be a Java Core problem. The same happens when auto-build is on and the file is closed.
*** This bug has been marked as a duplicate of 36032 ***