Project: JDT
Bug 160853 [extract method] Does not replace similar code in parent class of anonymous class
Reported: 2006-10-13 09:04:24 | Status: verified fixed

I20061010-0800 Given: package a.b; public class Foo { public void foo() { Object obj= new Object() { public String toString() { return "foo." + getName(); } }; String s= "foo." + getName(); } private String getName() {return "bar";} } 1. Select _second_ expression "foo." + getName() 2. Refactor>Extract Method... 3. extract method 'qualifiedName' Is: both expressions "foo." + getName() are replaced by a call to qualifiedName, correct. 4. Undo 5. Select first expression "foo." + getName() 6. Refactor>Extract Method... 7. Select 'Foo' as destination type 8. extract method 'qualifiedName' Is: Only first expression is replaced by call Should: Both expression should be replaced, at least I can't see no difference...

Files changed in fix:
org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/duplicates_in/A_test971.java org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/duplicates_in/A_test972.java org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/duplicates_out/A_test971.java org.eclipse.jdt.ui.tests.refactoring/resources/ExtractMethodWorkSpace/ExtractMethodTests/duplicates_out/A_test972.java org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/ExtractMethodTests.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/ExtractMethodRefactoring.java