| Summary: | [organize imports] organize imports does not remove unnecessary imports from the same package | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Nanda Firdausi <nanda.firdausi> |
| Component: | UI | Assignee: | JDT-UI-Inbox <jdt-ui-inbox> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | jarthana, nanda.firdausi, noopur_gupta |
| Version: | 4.5.1 | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | stalebug | ||
|
Description
Nanda Firdausi
I can't reproduce this. Can you help me with a test case or steps to reproduce? Create two source folders, e.g. javatests and java:
In java, create a class A in package Z, e.g:
package Z;
public class A {
}
In javatests, create class ATest in package Z, add a field a with type A, e.g:
package Z;
public class ATest {
A a;
}
Now refactor -> Move class A to package Y. A is now:
package Y;
public class A {
}
ATest is now:
package Z;
import Y.A;
public class ATest {
A a;
}
Now Reafctor -> Move class ATest to package Y. A is now:
package Y;
public class A {
}
ATest:
package Y;
import Y.A; <--- This import is unnecessary
public class ATest {
A a;
}
Even after I run organize import, that import statement is not being removed automatically.
Thanks, I see it now. After the refactor, the Organize Import does remove the import, though. Moving to UI for investigation. (In reply to Nanda Firdausi from comment #2) Which source folder contains package "Y"? With Eclipse Neon M4 build and steps in comment #2 (I tried keeping package Y in different source folders each time), I see that move refactoring updates the imports correctly i.e. there is no import in ATest after moving it to Y. Can you please check with Neon M4 and see if you can reproduce it with the given steps: http://download.eclipse.org/eclipse/downloads/drops4/S-4.6M4-201512092300/ Make sure that in the "Move" dialog, "Update references to 'ATest.java'" is checked (which is checked by default). 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. |