Method References

Rémi Forax forax at univ-mlv.fr
Fri Feb 26 10:11:13 PST 2010


Le 26/02/2010 17:15, Neal Gafter a écrit :
> On Fri, Feb 26, 2010 at 2:45 AM, Rémi Forax <forax at univ-mlv.fr 
> <mailto:forax at univ-mlv.fr>> wrote:
>
>     there is a source compatibility issue if you allow to not specify
>     the type.
>
>     class A {
>       void m(String s) { ... }
>     }
>     ....
>     ref = A#m;
>
>     Now suppose I want to add a new method m(Integer),
>
>
> Adding a new method to a class is not a source-compatible change today.

Oups.

> However, it is a binary-compatible change today and both with and 
> without method references and with or without the proposed method 
> reference argument inference.

Yes, overloading is resolved at compile time.

How do you expect to resolve generic method call ?

class A {
   static <T> T identity(T t) { ... }
}

A#identity   ???


In that case, is A#identity.("foo") equivalent to A.identity("foo") ?

Rémi




More information about the lambda-dev mailing list