Defender methods and compatibility
Peter Levart
peter.levart at marand.si
Wed Dec 1 00:43:47 PST 2010
On 11/30/10, Mark Thornton wrote:
> On 30/11/2010 08:18, Peter Levart wrote:
> > So the preferred way of defining a common extension method which could
> > be re-used by other vendors is to define a common super-interface with
> > a single extension method which all concerned interfaces would extend.
> > No SC breakage would result if this "single" definition is ever
> > changed (being inline or not).
> That common super interface needs to include all the methods relevant to
> the extension method.
In the absence of common super-interface two extension methods in unrelated interfaces with common default linkage means that the target static method has to deal with a common super-type of both interfaces (as 1st argument) which is java.lang.Object. Either it only has access to Object members or it has to assume different possible run-time implementations that could be passed to it and cast (which is ugly). So a common super-interface is desirable in this respect too.
Peter
>
> Mark
>
>
>
More information about the lambda-dev
mailing list