On Mon, 29 Sep 2025 23:36:00 GMT, Henry Jen <[email protected]> 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.
Is there a documentation change needed on the tool's doc page?
src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java line 446:
> 444: if (!Utils.isDisabled(plugin)) {
> 445: if (plugin instanceof DefaultStripDebugPlugin) {
> 446: defaultStripDebugPlugin =
> (DefaultStripDebugPlugin) plugin;
Suggestion:
if (plugin instanceof DefaultStripDebugPlugin plugin) {
defaultStripDebugPlugin = plugin;
src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/DefaultStripDebugPlugin.java
line 64:
> 62: }
> 63:
> 64: public void enableJavaStripPlugin(boolean enableJavaStripPlugin) {
This method name specifically implies enabling. Maybe "setEnabled..."?
src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/StripJavaDebugAttributesPlugin.java
line 88:
> 86:
> PluginsResourceBundle.getMessage("err.illegal.argument", rawArg));
> 87: }
> 88: }
This could be an expression switch that does nothing on `null` or `""` and
throws on `default`.
-------------
PR Review: https://git.openjdk.org/jdk/pull/27566#pullrequestreview-3282252887
PR Review Comment: https://git.openjdk.org/jdk/pull/27566#discussion_r2389585558
PR Review Comment: https://git.openjdk.org/jdk/pull/27566#discussion_r2389587641
PR Review Comment: https://git.openjdk.org/jdk/pull/27566#discussion_r2389591689