Skip to content

Conversation

slowhog
Copy link
Contributor

@slowhog slowhog commented Sep 29, 2025

Since parameters is an opt-in choice, it's more reasonable to consider that's desired information and make strip parameter names an opt-in choice as well.

This PR changes the default behavior of --strip-debug to keep parameter names when it's available. Add opt-in mechanism,
via the strip-java-debug-attributes plugin by using argument --strip-java-debug-attributes=+parameter-names.

The --strip-debug option is a little bit odd, as it's a main option as well as a plugin option to enable the DefaultStripDebugPlugin, which strip native debug information on platform support the feature, and strip java debug information. In this PR, we chose to support only one mechanism to enable strip parameter names, so we would disable the embed StripJavaDebugAttributesPlugin when StripJavaDebugAttributesPlugin is enabled.

The StripParameterNamesTest illustrate and verify parameter names use cases, mainly focus on argument processing and the parameter names. We didn't verify the regular debug info as that's covered by existing test.

-- Update

The latest change removed the support of strip parameter names, as the MethodParameters attribute is considered necessary attribute to fulfill Java Language Spec even though this attribute is considered optional by JVM spec.


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
  • Change requires a CSR request matching fixVersion 26 to be approved (needs to be created)

Issue

  • JDK-8347007: --strip-debug removes parameter names included with -parameters (Enhancement - P3)

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 27566

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@slowhog
Copy link
Contributor Author

slowhog commented Sep 29, 2025

/csr

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 29, 2025

👋 Welcome back henryjen! 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 Sep 29, 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 csr Pull request needs approved CSR before integration label Sep 29, 2025
@openjdk
Copy link

openjdk bot commented Sep 29, 2025

@slowhog has indicated that a compatibility and specification (CSR) request is needed for this pull request.

@slowhog please create a CSR request for issue JDK-8347007 with the correct fix version. This pull request cannot be integrated until the CSR request is approved.

@openjdk openjdk bot added the core-libs core-libs-dev@openjdk.org label Sep 29, 2025
@openjdk
Copy link

openjdk bot commented Sep 29, 2025

@slowhog The following label will be automatically applied to this pull request:

  • core-libs

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

@openjdk openjdk bot added the rfr Pull request is ready for review label Sep 29, 2025
@mlbridge
Copy link

mlbridge bot commented Sep 29, 2025

Webrevs

Copy link

@nlisker nlisker left a comment

Choose a reason for hiding this comment

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

Is there a documentation change needed on the tool's doc page?

this.stripNativePluginFactory = nativeStripPluginFact;
}

public void enableJavaStripPlugin(boolean enableJavaStripPlugin) {
Copy link

Choose a reason for hiding this comment

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

This method name specifically implies enabling. Maybe "setEnabled..."?


MethodTransform mt;
if (isDroppingMethodNames) {
mt = MethodTransform.dropping(me -> me instanceof MethodParametersAttribute)
Copy link
Member

Choose a reason for hiding this comment

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

I know this is already existing behavior, but removing the attribute doesn't just remove the parameter names but also the parameter flags. This results in the same bug that was fixed by https://bugs.openjdk.org/browse/JDK-8292275 (or for a more compact description, see the CSR https://bugs.openjdk.org/browse/JDK-8292467).

But that should be addressed separately.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for bring in this up. Do not support removal of MethodParameters attribute for now. If there is a need to support that, we can add a separate plugin to address optional attributes for JVM.

@slowhog
Copy link
Contributor Author

slowhog commented Oct 2, 2025

/csr remove

@openjdk
Copy link

openjdk bot commented Oct 2, 2025

@slowhog usage: /csr [needed|unneeded], requires that the issue the pull request refers to links to an approved CSR request.

@slowhog
Copy link
Contributor Author

slowhog commented Oct 2, 2025

/csr unneeded

@openjdk
Copy link

openjdk bot commented Oct 2, 2025

@slowhog only Reviewers can determine that a CSR is not needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs core-libs-dev@openjdk.org csr Pull request needs approved CSR before integration rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

3 participants