ARM API Support
Joe Darcy
joe.darcy at oracle.com
Thu Jul 29 16:39:32 PDT 2010
Florian Weimer wrote:
> * Joe Darcy:
>
>
>> There are no source compatibility issues with making a class implement
>> another interface if no new methods are added.
>>
>
> I think this statement permits certain exceptions.
>
Most rules do ;-)
> Here's code that breaks when a class implements another interface.
>
> class ToBeChanged implements I1 /*, I2 */ {
> }
>
> interface I1 {
> }
>
> interface I2 {
> }
>
> interface Dispatch {
> void action(I1 o);
> void action(I2 o);
> }
>
> class User {
> void use(Dispatch d, ToBeChanged o) {
> d.action(o);
> }
> }
>
> This particular case cannot happen if I2 is fresh and introduced at
> the time as ToBeChanged is changed because the user could not have
> written the Dispatch class.
>
Yes, if I2 is a pre-existing interface, the meaning of existing call
sites can be changed. However, that is not the case for AutoCloseable
and even when retrofitting Closeable, this case is of only minor concern.
Cheers,
-Joe
More information about the coin-dev
mailing list