[cross-project-issues-dev] Adding new default method to existing interface
I'm trying to understand if "adding default method to interface" API change is binary compatible for Eclipse project or not?
I've just checked  and have not found a hint how should we deal with the new "default" methods (Java 8) added to the existing interfaces.
Are we considering this as "Add API method -> If method need not be implemented by Client -> Binary compatible (0)" case from ?
Or do we threat this case as "Adding method to the public class" from , which has a very detailed but fuzzy example which says basically "yes and not", quote:
"However, if the method is added to a class which Clients may subclass, then the change should ordinarily be viewed as a breaking change. The reason for this harsh conclusion is because of the possibility that a Client's subclass already has its own implementation of a method by that name. Adding the API method to the superclass undercuts the Client's code since it would be sheer coincidence if the Client's existing method met the API contract of the newly added method. In practice, if the likelihood of this kind of name coincidence is sufficiently low, this kind of change is often treated as if it were non-breaking."
So which way do we like to deal with that?
I personally would love to see this change as "binary compatible", because this would allow easier interface evolution.
It would be nice to extend the guideline  by explicitly adding this case:
"Add API method -> If the new method has "default" qualifier (Java 8) -> Binary compatible (0)"
Also if this is true, and we consider this case as binary compatible, how about the existing guideline regarding "numbered" interfaces? (Example: IPerspectiveListener4 extends IPerspectiveListener3 extends IPerspectiveListener2 extends IPerspectiveListener)
Would we then also change this and allow interface evolution with new *default* methods without creating new interface?
See also Oracle guideline which strictly speaking says: it will be binary compatible but *can* in theory lead to runtime issues .