Community
Participate
Working Groups
---BugDemo.java--- interface A { void method(); } interface B { void method(); } interface ExtendsBoth extends A, B { } when either A.method() or B.method() is renamed to "renamed()", result is: ---BugDemo.java--- interface A { void renamed(); } interface B { void renamed(); } interface ExtendsBoth extends A, B { } Instead, should change only one or give a warning.
This is a long ongoing debate whether the two methods are related to each other or not by having the interface ExtendsBoth. Markus, we discussed this a couple of times. Depending on our final conclusion either mark the bug as fixed or as won't fix ;-).
We decided that the two methods are indeed related. Consider a class Client: class Client { void callMethod(ExtendsBoth eb) { eb.method(); } } The call eb.method() really calls both of the (abstract) methods and it can expect that the contracts in the javadocs of both A#method() and B#methods() are satisfied. Renaming just one of them alone would introduce a semantic shift. Furthermore, interfaces are meant to be implemented, and as soon as a subclass of ExtendsBoth implements #method(), the two methods from A and B are clearly related.