Overriding a default method

Brian Goetz brian.goetz at oracle.com
Thu Aug 9 17:24:41 PDT 2012

> With a small @Override enhancement both would be resolvable (removing
> from -Xlint results) without warning suppression.
> eg
> class X implements A, B {
>  @Override({A.class, B.class}) public void m() { ... }
> }
> This declares awareness of the collision for the Diamond case.  -Xlint
> can check them and behave appropriately.

Yes, the EG has already discussed this as a possible (backward compatible) improvement.  Our question is whether it would be used enough to be worthwhile.

More information about the lambda-dev mailing list