Skip to content

8358890: VM option -XX:AllowRedefinitionToAddDeleteMethods should be obsoleted then expired #26232

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sspitsyn
Copy link
Contributor

@sspitsyn sspitsyn commented Jul 10, 2025

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

Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8358890: VM option -XX:AllowRedefinitionToAddDeleteMethods should be obsoleted then expired (Bug - P4)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/26232/head:pull/26232
$ git checkout pull/26232

Update a local copy of the PR:
$ git checkout pull/26232
$ git pull https://git.openjdk.org/jdk.git pull/26232/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 26232

View PR using the GUI difftool:
$ git pr show -t 26232

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/26232.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jul 10, 2025

👋 Welcome back sspitsyn! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Jul 10, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot added the rfr Pull request is ready for review label Jul 10, 2025
@openjdk
Copy link

openjdk bot commented Jul 10, 2025

@sspitsyn The following labels will be automatically applied to this pull request:

  • core-libs
  • hotspot
  • serviceability

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

@mlbridge
Copy link

mlbridge bot commented Jul 10, 2025

Webrevs

Copy link
Member

@dholmes-ora dholmes-ora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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). These and other changes mean that some dependencies now require 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 reactor/BlockHound#33

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

@@ -4114,18 +4050,14 @@ void VM_RedefineClasses::flush_dependent_code() {
JvmtiExport::set_all_dependencies_are_recorded(true);
}

void VM_RedefineClasses::compute_added_deleted_matching_methods() {
void VM_RedefineClasses::compute_matching_methods() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@@ -522,7 +522,7 @@ void Arguments::init_version_specific_system_properties() {
static SpecialFlag const special_jvm_flags[] = {
// -------------- Deprecated Flags --------------
// --- Non-alias flags - sorted by obsolete_in then expired_in:
{ "AllowRedefinitionToAddDeleteMethods", JDK_Version::jdk(13), JDK_Version::undefined(), JDK_Version::undefined() },
{ "AllowRedefinitionToAddDeleteMethods", JDK_Version::jdk(13), JDK_Version::jdk(26), JDK_Version::jdk(27) },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@AlanBateman
Copy link
Contributor

/label remove core-libs

@openjdk
Copy link

openjdk bot commented Jul 10, 2025

@AlanBateman
The core-libs label was successfully removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants