javac crash for annotation on lambda formal parameter type

Alex Buckley alex.buckley at
Thu Dec 5 16:47:10 PST 2013

Starting at JDK8 b91, and continuing through b118, this innocuous 
program crashes javac:

import java.lang.annotation.*;
import java.util.function.*;

@interface TA {}

class LambdaFormal {
   IntUnaryOperator x = (@TA int y) -> 1;



This is weird because I'm sure I've annotated lambda formals in this 
fashion since b90. It's due to TYPE_USE - if TA's target is PARAMETER, 
then the program rightly compiles, while if TA's target is FIELD, you 
get the expected applicability error.

Before I file a P2 bug for this, can anyone add some color to the situation?


P.S. With a TA target of TYPE_USE, b90 produces a class file without the 
expected RuntimeVisibleTypeAnnotations attribute for @TA. But that's 
less of a concern right now.

More information about the type-annotations-dev mailing list