On 5/29/2021 12:20 AM, Jaroslav Tulach wrote:
This PR exposes runtime invisible annotations via `Class.getAnnotation` when
`-XX:+PreserveAllAnnotations` option is passed to the JVM.
Existing `-XX:+PreserveAllAnnotations` option can be very useful for code that
needs to access annotations with `RetentionPolicy.CLASS` without the need to
parse the .class files manually. While the RuntimeInvisibleAnnotations are kept
in the runtime, they are not visible via java.lang.reflect API. I assume that's
just an omission.
Not having CLASS retention annotations visible through the
java.lang.reflect API is not an omission, it is a design choice from JSR
175. If CLASS retention annotations were visible through
java.lang.reflec, they would just be RUNTIME retention annotations.
-Joe