Is a TYPE_USE annotation stored as such in a class file?

Laird Nelson ljnelson at gmail.com
Thu Feb 16 23:18:14 UTC 2023


On Thu, Feb 16, 2023 at 3:10 PM Alex Buckley <alex.buckley at oracle.com>
wrote:

> Looking at an annotation interface `A`'s @Target meta-annotation
> absolutely does tell you all the places that the annotation `@A` may
> appear. Everything about this is checked at compile time -- it has to be
> deterministic.
>
> For example, from `@Target(TYPE_USE)`, you can deduce that `@A` may
> appear on type uses, on class declarations, on interface declarations,
> and on type parameter declarations.
>

Let me put it a different way: what does annotating my annotation
with @Target({ ElementType.TYPE, ElementType.TYPE_PARAMETER,
ElementType.TYPE_USE }) accomplish that simply annotating it with @Target({
ElementType.TYPE_USE }) does not?

Thanks,
Laird
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/compiler-dev/attachments/20230216/daf2c390/attachment.htm>


More information about the compiler-dev mailing list