Community
Participate
Eclipse IDE
Build id: I20050627-1435 Does not happen always, seps are like this: 1. Type a class name within method body and hit Ctrl + Space to resolve class - this adds fully qualified class since auto imports are disabled. 2. Type '.' and access a field. Code looks like this: com.some.util.TypeDocs.SALES_MEMO 3. Hit Ctrl+Shif+M to add import. Import is added, but the dot before class name remains and must be removed manually. Code is like this: .TypeDocs.SALES_MEMO
Simple test case: type: java.util.Data<CTRL+SHIFT+M> It works if there's no compile error, e.g. java.util Date d; Tom, please investigate. If the fix is simple I'd like to backport this to 3.1.1.
OrganizeImports is jdt-ui. I see two different scenarios (| denotes the caret, press Ctrl+Shift+M): A) type import does not work with compile error: public class Test { Object m() { return java.util.Collections| } } -> adds type import, leaves the leading dot (works with trailing semicolon) B) static import on field does not work with compile error: public class Test { Object m() { return java.util.Collections.EMPTY_LIST| } } -> does not add static import for field (works with trailing semicolon) C) bogus import behavior for class literal: public class Test { Object m() { return java.util.Collections.class|; } } -> type gets removed, leading dot remains, no import added
Martin, can you please comment.
Created attachment 26193 [details] patch on AddImportsOperation.java
Created attachment 26194 [details] patch on AddImportTest.java
patches are for the orginal problem (comment 2, problem A). B is as intended, we need the AST here for static imports. C should be looked at. Suggest to file a different bug. patch would be a 3.1.1 candidate.
fixes released in 3.2 HEAD
(In reply to comment #6) > C should be looked at. Suggest to file a different bug. bug 107206
Patch looks OK to me. Approved for 3.1.1 (used to work in 3.0.2).
Tom, can you do the second review?
Patch looks good - ok.
fix released in 3.1.1 > 20050818
Start verification...
Verified using M20050831-1200.