Clarification on type use
Alex Buckley
alex.buckley at oracle.com
Thu Apr 3 19:27:57 UTC 2014
Eric, I am on type-annotations-dev, you don't need to cc me every time.
The TYPE_USE enum constant is specified in the javadoc for the
j.l.a.ElementType enum type: "The constant TYPE_USE corresponds to the
15 type contexts in JLS 4.11, as well as to two declaration contexts:
type declarations (including annotation type declarations) and type
parameter declarations." ["15" should be "16", there's a bug out for that.]
Alex
On 4/3/2014 9:19 AM, Eric McCorkle wrote:
> The following is exerpted from the test
> langtools/test/tools/javac/annotations/typeAnnotations/TypeUseTarget.java:
>
> @A
> class TypeUseTarget<K extends @A Object> {
> ...
> }
>
> @Target(ElementType.TYPE_USE)
> @interface A { }
>
>
> The first use of A seems to be on the class TypeUseTarget. The result
> with the current implementation is that javac produces a
> RuntimeInvisibleAnnotations attribute for the class TypeUseTarget.
>
> But is this valid? I can't seem to find anything in the type
> annotations spec that suggests that an annotation with a TYPE_USE target
> can wind up being a regular annotation on a class (or interface).
>
More information about the type-annotations-dev
mailing list