Javac internal error compiling lambdas

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Wed Apr 3 15:43:02 PDT 2013


Support for lambdas/mrefs in static context (in interfaces) is not yet fully supported as the compiler had to workaround some VM restrictions. Such restrictions have been recently addressed and we are working towards restoring the compiler code so that will do what it's supposed to.

Maurizio

----- Original Message -----
From: forax at univ-mlv.fr
To: lambda-dev at openjdk.java.net
Sent: Wednesday, April 3, 2013 10:04:04 PM GMT +00:00 GMT Britain, Ireland, Portugal
Subject: Re: Javac internal error compiling lambdas

On 04/03/2013 10:29 PM, Jose wrote:
>> I've fixed this in lambda repository. A promoted build containing the
>> fix will be available sometime next week.
>
> Maurizio,
>
> there were some more concerns lately regading javac.
>
> Woud this code compile now?. I have tons of lambdas in interfaces defining
> properties and they make javac to crash.
>
>
> import java.util.function.Predicate;
> interface Foo {
>      Predicate<?> TAUTOLOGY= t -> true;
> }
>
>

Again hijacking the thread,
there is no need to store a lambda in a static final field,
lambdas are automatically 'constantified' if they don't capture
values of variables in the scope. Moreover, lambdas are initialized
lazily instead of being initialized when the class/interface is initialized,
so storing a non-capturing lambda in a static field is counter productive.

cheers,
Rémi




More information about the lambda-dev mailing list