[External] : Re: Is a TYPE_USE annotation stored as such in a class file?

Alex Buckley alex.buckley at oracle.com
Thu Feb 16 23:30:33 UTC 2023


On 2/16/2023 3:01 PM, Alex Buckley wrote:
> Here is the annotation `@A` being applied in some type contexts:
> 
>    class B extends    @A Foo {}
>    class B implements @A Bar {}
>    class B<@A T extends @A Number> {} >
> These applications of `@A` are legal -- they are _type annotations_ -- 
> because they're applying to types (a.k.a. type uses -- of Foo, Bar, T, 
> Number) and the annotation interface `A` is applicable in type contexts.

Laird has kindly pointed out that I made an error: The T above is not a 
type use at all, but rather a declaration of a type parameter, so the 
annotation `@A` in `class B<@A T ...>` appears in a declaration context, 
and is a declaration annotation rather than a type annotation.

Alex


More information about the compiler-dev mailing list