On Mon, Jan 28, 2019 at 2:21 PM Pascal Schumacher <pascalschumac...@gmx.net>
wrote:

> Am 28.01.2019 um 20:01 schrieb Rob Tompkins:
> > Before I vote on the the thread, does adding a method to an interface
> cause BC to break?
>
> "Adding a method to an interface does not break compatibility with
> pre-existing binaries."
>

Of course it does break: I create a library L with interface A declaring
method M1, L calls M1 internally, and release it as 1.0. You implement A in
your app as ImplA.
I release 2.0 with A declaring M2 in A and also calling M1 and M2
internally. Your app updates to 2.0 and blows up when L tries to call M2 on
ImplA.

With Java 8, I can declare M2 as a _default_ method and nothing blows up,
you just get a default behavior that might be helpful or even be harmful.

Gary


>
> Source:
> https://docs.oracle.com/javase/specs/jls/se7/html/jls-13.html#jls-13.5.1
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> For additional commands, e-mail: dev-h...@commons.apache.org
>
>

Reply via email to