Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 37068 - Refactoring "change method signature" should fix implementors when return type changed [refactoring]
Summary: Refactoring "change method signature" should fix implementors when return typ...
Status: RESOLVED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.1   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 473926 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-04-29 15:17 EDT by David Whiteman CLA
Modified: 2015-08-05 04:42 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Whiteman CLA 2003-04-29 15:17:28 EDT
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.
Comment 1 Dirk Baeumer CLA 2003-04-30 03:38:52 EDT
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.
Comment 2 Noopur Gupta CLA 2015-08-05 04:42:29 EDT
*** Bug 473926 has been marked as a duplicate of this bug. ***