Latest draft of Defender Methods
Brian Goetz
brian.goetz at oracle.com
Mon Aug 16 14:03:51 PDT 2010
>> I've posted a new draft of Defender Methods at:
>>
>> http://cr.openjdk.java.net/~briangoetz/lambda/Defender%20Methods%20v3.pdf
>>
> 1. Will it be possible to undefault a specific method? Say that
> Collection<T> defines a default method for reduce(), will it be possible
> to create an interface derived from Collection<T> that says that
> reduce() will have to be implemented by the implementing class after all?
This is analogous to re-abstracting a concrete instance method, and seems a
desirable goal.
> 2. When compiling a class that implements an extended interface, I
> assume it will act as if implementations for all default methods have
> been provided, when deciding if the class has to be abstract?
Yes. Failing to provide an implementation for an extension method does not
leave you only partially in completion of the interface contract. Combining
this with (1) above, it is possible that a superclass is recompiled which
re-abstracts an extension method, making subclasses fail at runtime to
implement the interface contract. Again, this is analogous to the current
situation, where re-abstracting an instance method is not a binary compatible
change.
More information about the lambda-dev
mailing list