RFR: 8358890: VM option -XX:AllowRedefinitionToAddDeleteMethods should be obsoleted then expired [v2]

David Holmes dholmes at openjdk.org
Thu Jul 10 07:23:40 UTC 2025


On Thu, 10 Jul 2025 03:12:27 GMT, Serguei Spitsyn <sspitsyn at openjdk.org> wrote:

>> The VM option -XX:AllowRedefinitionToAddDeleteMethods was added in JDK 13 as a temporary backward compatibility flag under JDK-8192936 and was immediately marked as Deprecate. The fix is to obsolete this option in JDK 26 and expire in JDK 27.
>> 
>> TBD: Need to submit a related CSR.
>> 
>> There are two concerns which may require some negotiation with the Runtime (@coleenp @dcubed-ojdk @dholmes-ora) and SQE (@lmesnik) teams:
>>  - Class redefinition/retransformation can impact lambda expressions which are supported with private methods
>>  - Many tests depend on this VM option and are being removed. I'm not sure if it is okay to completely remove those e may want another way to handle this (e.g. problem-listing the impacted tests for now).
>>  
>> Testing:
>>  - mach5 tiers 1-6 are good
>>  - may need to run mach5 tiers > 6
>
> Serguei Spitsyn has updated the pull request incrementally with one additional commit since the last revision:
> 
>   corrected one assert message

This involved a lot more code than I had envisaged.

The test situation seems problematic as it suggests to me that we have required functionality (redefine a method containing a lambda expression) that is not possible without the flag. And it seems this flag is also being used in the wild e.g.

https://blog.picnic.nl/embracing-java-17-heres-what-we-learned-69779d95fdf2

> As of Java 16, JDK internals are strongly encapsulated by default ([JEP 396](https://openjdk.java.net/jeps/396)). These and other changes mean that some dependencies now [require](https://github.com/reactor/BlockHound/issues/33) additional JVM flags such as --add-opens and -XX:+AllowRedefinitionToAddDeleteMethods to function properly. We updated our shared build system such that teams can configure these flags in a single place, ensuring that test and production runtimes remain in sync.

With more info in https://github.com/reactor/BlockHound/issues/33

So I am quite concerned that this "workaround" has become entrenched.

src/hotspot/share/prims/jvmtiRedefineClasses.cpp line 4053:

> 4051: }
> 4052: 
> 4053: void VM_RedefineClasses::compute_matching_methods() {

I can't see that this method actually still does anything useful. ??

src/hotspot/share/runtime/arguments.cpp line 525:

> 523:   // -------------- Deprecated Flags --------------
> 524:   // --- Non-alias flags - sorted by obsolete_in then expired_in:
> 525:   { "AllowRedefinitionToAddDeleteMethods", JDK_Version::jdk(13), JDK_Version::jdk(26), JDK_Version::jdk(27) },

Please move this line to before line 535 (ParallelRefProcEnabled) so that we are sorted on obsolete_in as required.

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

PR Review: https://git.openjdk.org/jdk/pull/26232#pullrequestreview-3004272187
PR Review Comment: https://git.openjdk.org/jdk/pull/26232#discussion_r2196808392
PR Review Comment: https://git.openjdk.org/jdk/pull/26232#discussion_r2196813023


More information about the core-libs-dev mailing list