Community
Participate
Working Groups
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(); } }
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.
But then I should be able to point anywhere in hierarchy.