Project: JDT
Bug 250660 [introduce factory] destroys anonymous inner classes
Reported: 2008-10-13 11:35:17 | Status: verified fixed

Build ID: M20080911-1700 Steps To Reproduce: On this example code public class Foo { public Foo() { } public void foo() { new Foo() { public void foo() { } }; } } apply the "introduce factory" refactoring to the Foo constructor. The result is a call to createFoo in the foo method - the overridden foo method is lost! More information: This behavior obviously is quite dangerous, as it can change the behavior of a system dramatically and doesn't even produce any kind of warning. Basically, with this bug this refactoring shouldn't be relied upon at all.

Files changed in fix:
org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceFactory/Bugzilla/250660/HasAnonymous.java org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceFactory/Bugzilla/250660/HasAnonymous_out.java org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/IntroduceFactoryTests.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/IntroduceFactoryRefactoring.java