`Elements.getAllAnnotationMirrors` clarification?

Chen Liang chen.l.liang at oracle.com
Tue Apr 29 03:45:16 UTC 2025


Hi Josiah,
I think annotation inheritance only applies to superclasses and nothing else, not even superinterfaces  - and inherited annotations must have their interfaces annotated @Inherited. This is according to the documentation on the @Inherited annotation interface.

Regards, Chen
________________________________
From: compiler-dev <compiler-dev-retn at openjdk.org> on behalf of Josiah Noel <josiahnoel at gmail.com>
Sent: Monday, April 28, 2025 10:15 PM
To: compiler-dev at openjdk.org <compiler-dev at openjdk.org>
Subject: `Elements.getAllAnnotationMirrors` clarification?

Hey team,

Reading the Javadoc for Elements.getAllAnnotationMirrors, I got the impression that this method should include mirrors from super methods when given an executable element or mirrors from super classes when given a type element. Is this not the case?

I was trying both of these, but the result didn't appear to be any different than Element. getAnnotationMirrors(). In what situation does Elements.getAllAnnotationMirrors give a different result?

--
Cheers, Josiah.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/compiler-dev/attachments/20250429/00bc070c/attachment-0001.htm>


More information about the compiler-dev mailing list