Javac internal error compiling lambdas

Remi Forax forax at univ-mlv.fr
Wed Apr 3 13:50:28 PDT 2013


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