[External] : Re: Is a TYPE_USE annotation stored as such in a class file?
Laird Nelson
ljnelson at gmail.com
Thu Feb 16 23:09:21 UTC 2023
On Thu, Feb 16, 2023 at 3:01 PM Alex Buckley <alex.buckley at oracle.com>
wrote:
> In contrast, you are applying `@A` to a declaration, `class B {}`. Your
> application of `@A` is legal - it is a _declaration annotation_ -- because:
>
> A declaration annotation is ... an annotation that applies to a class,
> interface, or type parameter declaration, and whose annotation
> interface is applicable in type contexts (§4.11).
>
> That is, `A` being applicable in type contexts means `@A` can be applied
> very, very widely.
>
Thank you for the explanation, I think I understand now. TYPE_USE is in
pragmatic terms a superset of some other ElementTypes (such as TYPE; maybe
others; haven't thought it through) given that annotations so annotated can
be applied not just in type contexts but in (some? probably not all?)
declaration contexts as well. There is, in other words (check me on
this?), no effective difference at all between @Target({ ElementType.TYPE,
ElementType.TYPE_USE }) and @Target({ ElementType.TYPE_USE }).
L
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/compiler-dev/attachments/20230216/1e3e1808/attachment.htm>
More information about the compiler-dev
mailing list