| Summary: | [Organize imports] Adding unnecessary static import | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Pascal Filion <pascal.filion> | ||||
| Component: | Core | Assignee: | Ayushman Jain <amj87.iitr> | ||||
| Status: | CLOSED WONTFIX | QA Contact: | |||||
| Severity: | minor | ||||||
| Priority: | P3 | CC: | markus.kell.r, Olivier_Thomann | ||||
| Version: | 3.7 | ||||||
| Target Milestone: | --- | ||||||
| Hardware: | PC | ||||||
| OS: | Windows 7 | ||||||
| Whiteboard: | stalebug | ||||||
| Attachments: |
|
||||||
|
Description
Pascal Filion
Created attachment 183522 [details]
Shows the problem described
The second import is reported as unused, because the CONSTANT is resolved through the abstract class. If you are using a single import and not an import on demand, then it is not tagged as unused. So we need to detect that the second import is not needed as the first import can be used to resolve the second one. Markus, I am not sure the current infrastructure let us do this. I'll investigate. Imports are processed in their defined order. Since the first import can be used to resolve the constant CONSTANT1, the second one is reported as never used. I would say the fix in this case would be to detect that the second import is not needed inside OrganizeImport when the first import is using an import on demand. In this case we have a problem with the staticImportOnDemandThreshold. When the two imports for the static references are added, they are added as single imports. In this case, both imports are needed. But when they are converted to on demand import, one of them is not longer needed. I'll investigate how we can fix this. This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. |