Defender Extension Methods -- Resolution and Invoccation

Collin Fagan collin.fagan at gmail.com
Wed Aug 4 18:16:22 PDT 2010


I know I've voiced this before but I'm not a fan of defender methods. I just
don't see how this is not already multiple inheritance. Look I'm just your
average Joe programmer but I don't understand how the statement "a class
implementing two interfaces with two extension methods that collide is
easier. They should have the same default." can possibly be true. If each
interface provides a default how the heck is the programmer supposed to know
which one will eclipse the other? Are you saying the default implementation
needs to point to the same class/method? So when I use an interface from
common.lang and one from java.util and there just happens to be a collision
and they don't share the same default implementation only then am I going to
be alerted by the compiler that something is wrong? What happens when the
default changes? Does that mean at runtime there will be collsision that was
not intended at compile time? Is the default actually part of the method
signature? Will I get a method not found exception when there is a change?
Will every API developer get 1 and only 1 shot at picking a default
implementation?

I'm sorry I'm really happy with the hard work people are putting into this.
I'm just totally confused by defender methods.

Collin


On Wed, Aug 4, 2010 at 7:33 PM, Brian Goetz <brian.goetz at oracle.com> wrote:

> On 8/4/2010 7:38 PM, Rémi Forax wrote:
>
> > I think the syntax of defender method has some technical merits:
> > - solving the problem of a class implementing two interfaces with two
> > extension methods
> >     that collide is easier. They should have the same default.
>
> This one point alone should close down this discussion!
>
>
>
>


More information about the lambda-dev mailing list