> 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. > > This PR provides a new test and a fix to make `Class.getAnnotation(...)` > useful when `-XX:+PreserveAllAnnotations` option is on.
Jaroslav Tulach has updated the pull request incrementally with one additional commit since the last revision: Only expose non RetentionPolicy.RUNTIME annotations when -XX:+PreserveAllAnnotations is specified ------------- Changes: - all: https://git.openjdk.java.net/jdk/pull/4245/files - new: https://git.openjdk.java.net/jdk/pull/4245/files/e1aa800e..699861ef Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=4245&range=01 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=4245&range=00-01 Stats: 20 lines in 5 files changed: 19 ins; 0 del; 1 mod Patch: https://git.openjdk.java.net/jdk/pull/4245.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/4245/head:pull/4245 PR: https://git.openjdk.java.net/jdk/pull/4245