RFR: JDK-8267936: PreserveAllAnnotations option doesn't expose the annotation to Java code [v2]
Alan Bateman
alanb at openjdk.java.net
Mon May 31 07:10:18 UTC 2021
On Sun, 30 May 2021 20:06:49 GMT, Jaroslav Tulach <github.com+26887752+JaroslavTulach at openjdk.org> wrote:
> Obvious suggestion is to change the `@JavaScriptBody` retention to `RUNTIME` - however there are plenty of libraries already compiled with the existing annotation and they would have to be all recompiled to new version. I'd rather avoid that and that's another reason why I decided to bring the `-XX:+PreserveAllAnnotation` to your attention and propose to improve it.
I don't know anything about JavaScriptBody but this reads like they declared their annotations to have CLASS retention when they should have used RUNTIME retention. There's something very uncomfortable with changing the JDK as a workaround and telling JavaScriptBody users that you need to run with +PreserveAllAnnotations to get correct behavior. I would be concerned that leads to frameworks requesting it be the default so they can avoid parsing class files.
@dougxc @vnkozlov Has there been any other cases where the Graal compiler has needed to get access to the class files?
-------------
PR: https://git.openjdk.java.net/jdk/pull/4245
More information about the hotspot-runtime-dev
mailing list