Annotation on lambda formal parameter?
alex.buckley at oracle.com
Tue Dec 11 16:27:23 PST 2012
JSR 308 "Annotations on Java Types" will allow annotations on the
manifest type of a lambda expression's formal parameter, and on the type
and/or type argument in a method/constructor reference expression.
Is there any interest in having 308 allow an annotation on a lambda
formal parameter itself? That is, on the declaration of the parameter,
rather than its type. A declaration annotation is conceptually valid
even if the parameter declaration has no manifest type on which to write
a type annotation.
This is somewhat in scope for 308 because it already allows annotations
on declarations of type parameters (filling a hole from Java SE 5.0) and
it has the sub-method-level class file attributes needed to store
annotations on declarations of individual lambda parameters.
More information about the lambda-spec-comments