<div dir="ltr">I think this is deliberate and covered by <a href="https://docs.oracle.com/javase/specs/jls/se19/html/jls-9.html#jls-9.7.4">https://docs.oracle.com/javase/specs/jls/se19/html/jls-9.html#jls-9.7.4</a><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">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</blockquote><div><br></div><div> But I'm not completely sure, and welcome corrections to my reading of the spec :)</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Feb 16, 2023 at 1:31 PM Laird Nelson <<a href="mailto:ljnelson@gmail.com">ljnelson@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Another TYPE_USE question. Consider:<div><br></div><div><a class="gmail_plusreply" id="m_-2963487392803704152plusReplyChip-2">@Retention(RetentionPolicy.RUNTIME)</a><br></div><div>@Target({ ElementType.TYPE_USE })</div><div>@interface A {}</div><div><br></div><div><a class="gmail_plusreply" id="m_-2963487392803704152plusReplyChip-5">@A </a>class B{}</div><div><br></div><div>I am surprised to see @A in the returned array from B.class.getAnnotations() since it is not an element annotation.</div><div><br></div><div><div>Furthermore, I do not see the string "RuntimeVisibleTypeAnnotations" in the class file for B (which is why I'm writing to the compiler-dev list). I am no VM/bytecode person but I would expect to see that if a runtime-visible type use annotation is being recorded, yes? Although I do not see a place in the target_info structure that would to my naive eyes be suitable for this particular usage.</div></div><div><br></div><div>Is @A's usage here recorded in the wrong place as the wrong sort of thing? This has a whiff of <a href="https://bugs.openjdk.org/browse/JDK-8030751" target="_blank">https://bugs.openjdk.org/browse/JDK-8030751</a> to it but I wanted to confirm.</div><div><br></div><div>Thanks,</div><div>Laird<a class="gmail_plusreply"><br></a></div></div>
</blockquote></div>