A couple of questions about Project Lambda

Rémi Forax forax at univ-mlv.fr
Fri Aug 13 05:48:02 PDT 2010


Le 13/08/2010 14:19, Marcus Thiesen a écrit :
> Hi Lambda-Devs,
>    

the lambda project is a moving target :)

> I toyed around a little bit with the latest Lambda prototype and got a
> couple of questions. I used the mercurial version as of today against
> jdk7 build 104 as described in [1].
>
> SAM Conversion:
> The spec in [2] says "A SAM (Single Abstract Method) type is a
> top-level class or interface
> type with abstract member". I misread this as "top-level class or
> top-level interface", but the implementation actually works with
> member interfaces [3] which strikes me as inconstistent because I can
> use SAM conversion with a member interface but not with a member
> class, is there any reason for this?
>    

A member class (not static) has a back reference to its enclosing class.

> Function Types:
> Trying to compile [4] does not work:
>
> (master)->marcus at lindan:~/src/java7/lambda:
> ../../java/langtools/dist/bin/javac -source 7 -XDallowFunctionTypes
> FunctionTypes.java
> FunctionTypes.java:3: function types are not supported in -source 1.7
>      public String resolver( final String value, #String(String) function ) {
>                                                   ^
>    (use -source 7 or higher and -XDallowFunctionTypes to enable function types)
> 1 error
>
> I guess this is due to my setup but is it supposed to work like this
> or are the Function Types pure virtual types that I can not declare as
> the type of a variable?
>    

You can't use function types anymore.
As today, the spec doesn't include any function type notation anymore.

> Defender Methods:
> Running [5] gives me an AbtractMethodError but compiles, somehow he is
> looking for an implementation of the actual method without the
> interface extra argument.
>    

The compiler knows what a defender method is,
but currently the VM don't.
You will have to wait a little bit :)

> Furthermore I would like to know if a Interface with only one single
> not defender Method should actually qualify for SAM conversion,
> apparently it does not work that way atm.
>
> Any feedback would be welcome,
>
>      Marcus
>    

Rémi


More information about the lambda-dev mailing list