Updated State of the Lambda
Brian Goetz
brian.goetz at oracle.com
Tue Dec 13 06:52:43 PST 2011
>> While technically one could read this and not require a compilation error at
>> the point where an interface covariantly overrides a default method without
>> either providing a new default clause (concrete or default none), it would
>> be silly to push the error to the point where that interface is inherited by
>> a class. So the error happens at the point at which the pollution is
>> introduced.
>
> Does this mean that an extended interface BidirectionalMap<K,V>
> extends java.util.Map<K,V> {
> Set<V> values();
> }
>
> will be rendered incompilable, should the JDK developers decide to add
> a default body to interface java.util.Map {
> Collection<V> values() default {...}
> }
Yes, in that case, BidirectionMap would need to acquire a "default none"
before its next compilation. (Though I don't think you should call that
"uncompilable", since there is an obvious and safe fix.)
> ? Wouldn't this be an annoying incompatibility?
> By simply leaving the re-abstraction-by-re-declaration rules intact,
> no such incompatibilities would be introduced.
Yes, but this causes other problems. There's no free lunch here; the
game is to move the problem to where it does the least damage.
More information about the lambda-dev
mailing list