RFR: 8347007: --strip-debug removes parameter names included with -parameters [v2]
Hannes Greule
hgreule at openjdk.org
Tue Sep 30 06:32:59 UTC 2025
On Tue, 30 Sep 2025 05:30:20 GMT, Henry Jen <henryjen at openjdk.org> wrote:
>> 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.
>
> Henry Jen has updated the pull request incrementally with one additional commit since the last revision:
>
> Support optional argument for PluginOptions
src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StripJavaDebugAttributesPlugin.java line 53:
> 51:
> 52: private final Predicate<String> predicate;
> 53: private boolean isDroppingMethodNames;
This should probably be `isDroppingMethodParameterNames`
src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StripJavaDebugAttributesPlugin.java line 113:
> 111: MethodTransform mt;
> 112: if (isDroppingMethodNames) {
> 113: mt = MethodTransform.dropping(me -> me instanceof MethodParametersAttribute)
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.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27566#discussion_r2389987282
PR Review Comment: https://git.openjdk.org/jdk/pull/27566#discussion_r2390000664
More information about the core-libs-dev
mailing list