Formal model for defender method resolution

Stephen Colebourne scolebourne at joda.org
Tue Feb 1 05:13:45 PST 2011


On 1 February 2011 13:05, Peter Levart <peter.levart at marand.si> wrote:
> But this allows one to question whether also the following is possible (and why not?)
>
> interface A {
>  Object m() default Defaults.m;
> }
>
> interface B extends A {
>  Object n() default A.m;
> }
>
> .. which is confusing.

Why confusing? Its obvious to me:

A's author says  "please use Defaults.m if not overridden".
B's author says  "please use A.m() if not overridden".

In general it says "if not overridden then use x". We shouldn't be
stricter than we need to be about what "x" is.

I will grant that there is a new circular reference possibility
introduced if two defaults in the same interface reference each other.

Stephen


More information about the lambda-dev mailing list