RFR: JDK-8328137: PreserveAllAnnotations can cause failure of class retransformation

Alex Menkov amenkov at openjdk.org
Wed Apr 3 00:26:13 UTC 2024


On Tue, 2 Apr 2024 19:13:15 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

> At one point long ago, I was trying to understand why we have PreserveAllAnnotations and couldn't come up with a reason. For a class file reconstitutor, restoring the invisible annotations to the classfile and then feeding it back to the JVM should have no effect, since the VM doesn't do anything with these annotations.
> 
> I see now why you get the original assert. I think this looks like a reasonable workaround for this problem.
> 
> I wonder if we can deprecate PreserveAllAnnotations. Wonder what it's for? It would need a CSR because it's a product flag.

I also was not able to identify purpose of the flag.
I found couple PRs from 2021 about the flag: #4245 and #4280 with a description of possible usecase for it, but it does not look as a good reason to me.
I'll create a CR to deprecate the flag.

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

PR Comment: https://git.openjdk.org/jdk/pull/18540#issuecomment-2033319487


More information about the serviceability-dev mailing list