Community
Participate
Working Groups
I have an interface, IFoo, and a class that implements it, Foo. When I change the return type of a method in IFoo from void to boolean, the corresponding method in Foo should be changed so that the return points return a boolean as well. For example,IFoo implements: void widgetSelected(int index); And Foo has the method as follows: public void widgetSelected(int index) { if (index = -1) return; sendSelectedEvent(index); } Then if I refactor to change the return type of widgetSelected() in the interface to boolean, the new version of that method in Foo should look like: public boolean widgetSelected(int index) { if (index = -1) return false; sendSelectedEvent(index); return false; } I believe refactoring should result in compileable code, and it does not if the return points aren't changed. Currently only the signature of the Foo method is changed, thus resulting in a compile error after refactoring. In this example, I am assuming that false would be used in each case, simply because false is the default value for an uninitialized boolean field.
In general, refactorings should end up in compilable code. Change method signature is somnehow differernt since it changes behaviour, thus we can't always keep the code compilable. What should we do if wou change the return type from boolean to void on the calling side. Hence we decide to not fix the code so that the user has a clue where to look at when using change method signature.
*** Bug 473926 has been marked as a duplicate of this bug. ***