Summary: | Member types imports are removed too aggressively | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Olivier Thomann <Olivier_Thomann> | ||||||
Component: | Core | Assignee: | Olivier Thomann <Olivier_Thomann> | ||||||
Status: | VERIFIED FIXED | QA Contact: | |||||||
Severity: | normal | ||||||||
Priority: | P3 | CC: | aniefer, daniel_megert, markus.kell.r, pascal, thomas | ||||||
Version: | 3.6 | ||||||||
Target Milestone: | 3.6 M6 | ||||||||
Hardware: | All | ||||||||
OS: | All | ||||||||
Whiteboard: | |||||||||
Attachments: |
|
Description
Olivier Thomann
2010-02-24 10:49:02 EST
To reproduce, the 'Organize Imports' preference for number of needed imports must be set to something low, e.g. 0. Created attachment 160089 [details]
Proposed fix + regression test
I quickly glanced over the patch (didn't try it out). If I understood that right, ImportRewriteAnalyzer.ImportDeclEntry#getSimpleName() is now actually returning the typeQualifiedName, so it should be renamed. But I see a problem in ImportRewriteAnalyzer#evaluateStarImportConflicts(..) then, because there, the "simple" names are stored in simpleTypeNames, which is passed to a SearchEngine#searchAllTypeNames(..) method that only expects simple names. (In reply to comment #3) > I quickly glanced over the patch (didn't try it out). If I understood that > right, ImportRewriteAnalyzer.ImportDeclEntry#getSimpleName() is now actually > returning the typeQualifiedName, so it should be renamed. I'll check that. > But I see a problem in ImportRewriteAnalyzer#evaluateStarImportConflicts(..) > then, because there, the "simple" names are stored in simpleTypeNames, which is > passed to a SearchEngine#searchAllTypeNames(..) method that only expects simple > names. Ok, I'll take a look. Thanks. (In reply to comment #3) > I quickly glanced over the patch (didn't try it out). If I understood that > right, ImportRewriteAnalyzer.ImportDeclEntry#getSimpleName() is now actually > returning the typeQualifiedName, so it should be renamed. I would say it actually returns the type name inside the package. I create a new method called: getTypeQualifiedName(); > But I see a problem in ImportRewriteAnalyzer#evaluateStarImportConflicts(..) > then, because there, the "simple" names are stored in simpleTypeNames, which is > passed to a SearchEngine#searchAllTypeNames(..) method that only expects simple > names. I am using the new method only when computing the remaining imports for a group of imports and the threshold has been reached. Created attachment 160106 [details]
Proposed fix + regression test
Released for 3.6M6. Regression test added in: org.eclipse.jdt.core.tests.rewrite.describing.ImportRewriteTest#testAddImports5 *** Bug 304111 has been marked as a duplicate of this bug. *** Verified for 3.6M6 using I20100307-2000 build. |