Final defenders

Sven Efftinge sven at efftinge.de
Tue Aug 7 11:29:03 PDT 2012


On Aug 7, 2012, at 4:34 PM, Aleksey Shipilev <aleksey.shipilev at oracle.com> wrote:
> public interface StatefulOp<T, U, V> {
>    public final boolean isStateful() default {
>        return true;
>    }
> }
> 
> "final" is not allowed in interfaces by the current rules, so we can use
> this loophole to introduce a new meaning. However, this feels wrong to
> provide the default implementation, and instantly forbid the extension.
> So, maybe this is better:
> 
> public interface StatefulOp<T, U, V> {
>    public boolean isStateful() final {
>        return true;
>    }
> }

What is the reasoning behind the 'default' keyword anyway?
Is there an ambiguity?

Sven


More information about the lambda-dev mailing list