Project: JDT
Bug 170182 [dnd] Relocating a method via outline-view causes an import to be removed
Reported: 2007-01-11 04:18:10 | Status: resolved fixed

Given the following file: <QUOTE> import java.util.ArrayList; import java.util.HashMap; import java.util.Set; public class A { private HashMap<String, Integer> hashMap = new HashMap<String, Integer>(1); public Set<String> getStrings() { return hashMap.keySet(); } public void setInts(Integer integer, String str) { hashMap.put(str, integer); } public A(ArrayList<String> strings) { for (String ip : strings) { hashMap.put(ip, new Integer(1)); } } public Integer getInts(String fromIpAddress) { return hashMap.get(fromIpAddress); } } <UNQUOTE> When I drag the constructor, via the "outline" view, and drop it as the first among methods, the "import java.util.ArrayList;" line is removed (subsequently causing a compilation error). Thanks, Amit

Files changed in fix:
org.eclipse.jdt.ui.tests.refactoring/resources/Move/testDestination_fieldWithImport/in/A.java org.eclipse.jdt.ui.tests.refactoring/resources/Move/testDestination_fieldWithImport/out/A.java org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/ccp/MoveTest.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/structure/ImportRewriteUtil.java