On 3/06/2021 2:54 am, Joe Darcy wrote:
If the reflection runtime doesn't implement the semantics of -XX+PreserveAllAnnotations, I suggest deprecating/obsoleting/etc. that option now.

I have to agree with Joe now. I mistakenly thought the raw annotation stream was exposed to some parts of reflection, but now I see that it all goes through AnnotationParser, which strips out all non-Runtime retention annotations. So the flag is useless as the data it causes to be passed to the JDK is thrown away anyway.

Cheers,
David

-Joe

On 6/2/2021 7:48 AM, Peter Levart wrote:
On Tue, 1 Jun 2021 09:30:40 GMT, Jaroslav Tulach <github.com+26887752+jaroslavtul...@openjdk.org> wrote:

There doesn't seem to be much support for the complete changes in #4245. To get at least something useful from that endeavor I have extracted the test for existing behavior of `-XX:+PreserveAllAnnotations` and I am offering it in this pull request without any changes to the JVM behavior.
What I would do is to add a patch for the parser bug and then extend the test in 3 dimensions: - run it with and without the `-XX+PreserveAllAnnotations` option (adapt expected results accordingly) - test annotation use when besides the annotation that changes retention from CLASS -> RUNTIME there is another RUNTIME annotation present on the annotated element or not (this would fail before the bugfix) - test with different annotated elements (Class, Method, Field, Constructor, Parameter) to exercise different code paths in the VM.

-------------

PR: https://git.openjdk.java.net/jdk/pull/4280

Reply via email to