Project: JDT
Bug 17020 Refactor move class not updating imports
Reported: 2002-05-22 15:41:38 | Status: verified fixed

Build 20020521 (Freeze 1) This is the strangest error. Follow these steps very closely to reproduce. Package names must be exactly the same... 1) Create a java project 2) Add the swt.jar to the project build path 3) Create two packages, "test.package1" and "test.package2". 4) In "test.package1", define two classes: --- start A.java -------- package test.package1; import org.eclipse.swt.SWT; import org.eclipse.swt.events.PaintEvent; import org.eclipse.swt.events.PaintListener; import org.eclipse.swt.graphics.*; import org.eclipse.swt.widgets.*; public class A { B b; } --- end A.java ----------- --- start B.java -------- package test.package1; public class B { } --- end B.java ----------- 5) In the packages view, drag and drop B.java into package "test.package2". 6) When it prompts you, choose "Preview" to preview the changes 7) Note in the preview dialog, it shows "A.java" in the list, but the compare panes at the bottom don't show any changes 8) Click finish. There is now a compile error in A.java. It failed to update the imports when B was moved. Some very subtle changes will make this test case no longer work. For example, if you remove the SWT imports, it correctly refactors the code.

Files changed in fix:
org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/codemanipulation/ImportsStructure.java