Community
Participate
Working Groups
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.
*** Bug 185762 has been marked as a duplicate of this bug. ***
185762 is more than a duplicate of this bug: The parameter can only used as is for recursive calls when: - none of the values have changed - all parameters are passed in the correct order
But the solution is the same ;) Create a new Parameter Object for every recursive call.
Created attachment 66477 [details] Patch for recursion problems Only passes parameterObjects if all parameters have been inlined and are in same order.
patch is good. I don't like the no-op changes at the end, but apart from that its good. Markus you should have a look at the changes to ChangeSignatureRefactoring.
Improved loop in createChangeManager(..) by only storing non-declaration updates in an ArrayList. Released to HEAD with a few cosmetics.
verified in I20070516-0010