hg: lambda/lambda/langtools: Implemented features are:
Paul Benedict
pbenedict at apache.org
Fri Jul 30 09:36:52 PDT 2010
Maurizio,
This looks really good. Forgive me if wrong, but I noticed the SAM
conversion functionality is (like) duck typing. The lambda expression can
get wrapped in an Interface proxy of the appropriate signature.
I made an example of my own. Should I expect this to compile? If so, what
should I expect from my instanceof assertions?
public class MethodReferenceXX {
interface Getter<T> {
public T get();
}
static class Foo {
public Integer get() {
return 0;
}
}
public static <T> T test(Getter<T> getter) {
assertTrue(getter instanceof Getter);
assertTrue(getter instanceof Foo);
return getter.get();
};
public static void main(String... args) {
Foo foo = new Foo();
test(foo#get);
}
}
Paul
On Fri, Jul 30, 2010 at 9:49 AM, <maurizio.cimadamore at oracle.com> wrote:
> Changeset: b4b3b410e1c1
> Author: mcimadamore
> Date: 2010-07-30 15:47 +0100
> URL:
> http://hg.openjdk.java.net/lambda/lambda/langtools/rev/b4b3b410e1c1
>
> Implemented features are:
>
> *) Method References
> Method references have been implemented using the 'infix' notation
> suggested by John Rose. For example, a method reference for a method m in
> class A is denoted as 'A#m'. Method references can include an actual
> argument types list (in order to disambiguate in case of overload
> resolution). Big thanks to John Rose, as I re-used most of the code for
> handling code generation of method handle literals.
>
> *) Effectively final analysis
> Local variables that are never assigned can now be referenced from a lambda
> body.
>
> *) Removed explicit support for function types
> The option -XDallowFunctionTypes has been removed. As a result, SAM types
> are the only legitimate target types for lambda expressions/method refs.
>
> *) Miscellaneous bug fixes (thanks to Peter Levart for the feedback).
>
> TODO:
>
> *) break/continue/return
>
>
More information about the lambda-dev
mailing list