Project: JDT
Bug 48504 Exception while introducing factory [refactoring]
Reported: 2003-12-11 12:20:45 | Status: resolved fixed

I20031203 with your latest patch: try introducing a factory method for constructor A in class B. Code I used is: public class A { { field= 10; } public A() { } private int field; static class XX extends A { public void foo() { bar(); } public void bar() { } } public void foo(int y) { Runnable runnable= new Runnable() { private int field; public void run() { { A a= null; } } }; } public String foo(String ss) { A a= new A(); return ss; } } /* * Created on Nov 12, 2003 * * To change the template for this generated file go to * Window - Preferences - Java - Code Generation - Code and Comments */ /** * @author dbaeumer * * To change the template for this generated type comment go to * Window - Preferences - Java - Code Generation - Code and Comments */ public class B { private static interface I { public void foo(); } private static class CC implements I { public void foo() { } } public void foo() { I i= new I() { public void foo() { } public void bar() { foo(); } }; CC c= new CC() {}; B b; } public void bar() { class X { public void baz() { } } class Y extends X { public void baz() { } } } } exception is: 'org.eclipse.jdt.core.dom.SimpleName('XX')' in compilation unit 'A.java'] at java.lang.Throwable.<init>(Throwable.java) at java.lang.Throwable.<init>(Throwable.java) at org.eclipse.core.runtime.CoreException.<init>(CoreException.java:35) at org.eclipse.jdt.core.JavaModelException.<init> (JavaModelException.java:67) at org.eclipse.jdt.internal.corext.refactoring.code.IntroduceFactoryRefactoring.ge tCtorCallAt(IntroduceFactoryRefactoring.java:857) at org.eclipse.jdt.internal.corext.refactoring.code.IntroduceFactoryRefactoring.re placeConstructorCalls(IntroduceFactoryRefactoring.java:788) at org.eclipse.jdt.internal.corext.refactoring.code.IntroduceFactoryRefactoring.ad dAllChangesFor(IntroduceFactoryRefactoring.java:720) at org.eclipse.jdt.internal.corext.refactoring.code.IntroduceFactoryRefactoring.cr eateChange(IntroduceFactoryRefactoring.java:902) at org.eclipse.jdt.internal.ui.refactoring.CreateChangeOperation.run (CreateChangeOperation.java:104) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run (ModalContext.java:101)

Files changed in fix:
org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceFactory/Bugzilla/48504/p1/A.java org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceFactory/Bugzilla/48504/p1/A_out.java org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceFactory/Bugzilla/48504/p1/B.java org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceFactory/Bugzilla/48504/p1/B_out.java org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/IntroduceFactoryTests.java