TYPE_USE target and repeatable annotations.
alex.buckley at oracle.com
Mon Nov 11 18:41:20 PST 2013
JSR 308 introduced ElementType.TYPE_USE as pertaining not only to uses
of types but also to declarations of types; logically, it's a
"supertype" of ElementType.TYPE. The rationale is to simplify migration
of annotation types which have a target of ElementType.TYPE but would
like to have their annotations work on uses of types. The time to
discuss this rationale has long passed.
Separately, ElementType.TYPE is logically a supertype of
ElementType.ANNOTATION_TYPE. You've been able to write a TYPE annotation
on the declaration of an annotation type since 2004.
Together, this means you can write a TYPE_USE annotation on the
declaration of an annotation type.
On 11/11/2013 5:55 PM, Srikanth S Adayapalam wrote:
> > Again, a TYPE_USE annotation has always been allowed by JSR 308 wherever
> > a TYPE annotation is allowed,
> Well, "Has always been allowed" is not an argument for it being correct,
> sound or meaningful - is it ?
> > which includes declarations of annotation
> > types. So there is nothing wrong with this program.
> What is the meaning of the type use annotation being applied to an
> declaration ? Perhaps this is the piece missing in my understanding.
More information about the type-annotations-spec-experts