Is a TYPE_USE annotation stored as such in a class file?
Laird Nelson
ljnelson at gmail.com
Thu Feb 16 22:54:33 UTC 2023
On Thu, Feb 16, 2023 at 2:41 PM Alex Buckley <alex.buckley at oracle.com>
wrote:
> Correct. The `@A` in `@A class B {}` is a declaration annotation, hence
> appears in a RuntimeVisibleAnnotations attribute in B.class.
>
> The next line in 9.7.4 is:
>
> A type annotation is an annotation that applies to a type
> (or any part of a type), and whose annotation interface is
> applicable in type contexts.
>
> Since this `@A` doesn't apply to a type, it's not a type annotation,
> hence there is no RuntimeVisibleTypeAnnotations attribute.
>
How very interesting. So in pragmatic terms, merely looking at an
annotation's @Target annotation does not, by itself, tell you all the
places it could be used or where it might show up reflectively. I learn
something new every day. Thanks for your patience and time.
Best,
Laird
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/compiler-dev/attachments/20230216/04043451/attachment.htm>
More information about the compiler-dev
mailing list