Project: JDT
Bug 185743 [introduce parameter object] introduces stack overflow on recursions
Reported: 2007-05-07 08:34:07 | Status: verified fixed

I20070503-1400 Given: package test; public class E1 { public void countDown(int i) { if (i == 0) { System.out.println("bumm!"); return; } System.out.println(i); countDown(--i); } public static void main(String[] args) { new E1().countDown(10); } } 1. Select countDown 2. Introduce Parameter Object 3. Accept defaults Is: package test; public class E1 { public void countDown(CountDownParameter parameterObject) { int i = parameterObject.i; if (i == 0) { System.out.println("bumm!"); return; } System.out.println(i); countDown(parameterObject); } public static void main(String[] args) { new E1().countDown(new CountDownParameter(10)); } } Same problem when writing i= i - 1; countDown(i); Should: Not do that;-) I guess create a new parameter object for recursive call would be the easiest thing to do.

Files changed in fix:
org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceParameterObject/testRecursiveReordered/in/TestRecursiveReordered.java org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceParameterObject/testRecursiveReordered/out/TestRecursiveReordered.java org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceParameterObject/testRecursiveSimple/in/TestRecursiveSimple.java org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceParameterObject/testRecursiveSimple/out/TestRecursiveSimple.java org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceParameterObject/testRecursiveSimpleReordered/in/TestRecursiveSimpleReordered.java org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceParameterObject/testRecursiveSimpleReordered/out/TestRecursiveSimpleReordered.java org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/IntroduceParameterObjectTests.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/ParameterInfo.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/structure/ChangeSignatureRefactoring.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/structure/IDefaultValueAdvisor.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/structure/IntroduceParameterObjectRefactoring.java