Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 124278 - [refactoring] Change method signature : altered code it shouldn't have modified
Summary: [refactoring] Change method signature : altered code it shouldn't have modified
Status: RESOLVED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-18 06:03 EST by Philipe Mulet CLA
Modified: 2006-01-18 11:47 EST (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 Philipe Mulet CLA 2006-01-18 06:03:26 EST
3.2m4

Simple testcase:
public class X {
	void foo(){}
}
class Y extends X {
	void foo(){}
}
class Z {
	void bar(X x) {
		x.foo();
	}
}

Select Y#foo() and change its signature to add an extra parameter (int newParam),
it will alter Z, though Z shouldn't be altered as only Y#foo() got selected.

public class X {
	void foo(int newParam){}
}
class Y extends X {
	void foo(int newParam){}
}
class Z {
	void bar(X x) {
		x.foo(0);
	}
}

Ideally, to preserve semantics, refactoring should have created a bridge method on Y:
public class X {
	void foo(){}
}
class Y extends X {
        void foo() { foo(0); }
	void foo(int newParam){}
}
class Z {
	void bar(X x) {
		x.foo();
	}
}
Comment 1 Martin Aeschlimann CLA 2006-01-18 10:16:51 EST
Change method signature always works on overridding and overridden methods together. In the latest builds you can decide to leave a delegate, that means the old method is kept.

Markus, maybe you want to comment.
Comment 2 Philipe Mulet CLA 2006-01-18 11:47:09 EST
But then I should be able to point anywhere in hierarchy.