On Thu, 2 Oct 2025 05:40:49 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.
>> 
>> -- 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.
>
> Henry Jen has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   MethodParameters attribute should not be removed

test/jdk/tools/jlink/plugins/StripParameterNamesTest.java line 67:

> 65:     private static List<Jmod> testJmods = new ArrayList<>();
> 66: 
> 67:     record Jmod(Path moduleDir, boolean withDebugInfo, boolean 
> withParameterNames) {}

Is the withDebugInfo component used?

test/jdk/tools/jlink/plugins/StripParameterNamesTest.java line 67:

> 65:     private static List<Jmod> testJmods = new ArrayList<>();
> 66: 
> 67:     record Jmod(Path moduleDir, boolean withDebugInfo, boolean 
> withParameterNames) {}

Is the withDebugInfo component used?

test/jdk/tools/jlink/plugins/StripParameterNamesTest.java line 67:

> 65:     private static List<Jmod> testJmods = new ArrayList<>();
> 66: 
> 67:     record Jmod(Path moduleDir, boolean withDebugInfo, boolean 
> withParameterNames) {}

Is the withDebugInfo component used?

test/jdk/tools/jlink/plugins/StripParameterNamesTest.java line 67:

> 65:     private static List<Jmod> testJmods = new ArrayList<>();
> 66: 
> 67:     record Jmod(Path moduleDir, boolean withDebugInfo, boolean 
> withParameterNames) {}

Is the withDebugInfo component used?

test/jdk/tools/jlink/plugins/StripParameterNamesTest.java line 67:

> 65:     private static List<Jmod> testJmods = new ArrayList<>();
> 66: 
> 67:     record Jmod(Path moduleDir, boolean withDebugInfo, boolean 
> withParameterNames) {}

Is the withDebugInfo component used?

test/jdk/tools/jlink/plugins/StripParameterNamesTest.java line 67:

> 65:     private static List<Jmod> testJmods = new ArrayList<>();
> 66: 
> 67:     record Jmod(Path moduleDir, boolean withDebugInfo, boolean 
> withParameterNames) {}

Is the withDebugInfo component used?

test/jdk/tools/jlink/plugins/StripParameterNamesTest.java line 67:

> 65:     private static List<Jmod> testJmods = new ArrayList<>();
> 66: 
> 67:     record Jmod(Path moduleDir, boolean withDebugInfo, boolean 
> withParameterNames) {}

Is the withDebugInfo component used?

test/jdk/tools/jlink/plugins/StripParameterNamesTest.java line 221:

> 219:     @Test
> 220:     public void testWithoutStripParameterName() throws Exception {
> 221:         var imageDir = Paths.get("img");

(You can replace all uses of Paths.get with Path.of if you want)

Are we missing a 4th test to test --strip-java-debug-attributes on its own?

test/jdk/tools/jlink/plugins/StripParameterNamesTest.java line 221:

> 219:     @Test
> 220:     public void testWithoutStripParameterName() throws Exception {
> 221:         var imageDir = Paths.get("img");

(You can replace all uses of Paths.get with Path.of if you want)

Are we missing a 4th test to test --strip-java-debug-attributes on its own?

test/jdk/tools/jlink/plugins/StripParameterNamesTest.java line 221:

> 219:     @Test
> 220:     public void testWithoutStripParameterName() throws Exception {
> 221:         var imageDir = Paths.get("img");

(You can replace all uses of Paths.get with Path.of if you want)

Are we missing a 4th test to test --strip-java-debug-attributes on its own?

test/jdk/tools/jlink/plugins/StripParameterNamesTest.java line 221:

> 219:     @Test
> 220:     public void testWithoutStripParameterName() throws Exception {
> 221:         var imageDir = Paths.get("img");

(You can replace all uses of Paths.get with Path.of if you want)

Are we missing a 4th test to test --strip-java-debug-attributes on its own?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27566#discussion_r2416862433
PR Review Comment: https://git.openjdk.org/jdk/pull/27566#discussion_r2416862740
PR Review Comment: https://git.openjdk.org/jdk/pull/27566#discussion_r2416866887
PR Review Comment: https://git.openjdk.org/jdk/pull/27566#discussion_r2416869328
PR Review Comment: https://git.openjdk.org/jdk/pull/27566#discussion_r2416869655
PR Review Comment: https://git.openjdk.org/jdk/pull/27566#discussion_r2416870113
PR Review Comment: https://git.openjdk.org/jdk/pull/27566#discussion_r2416870371
PR Review Comment: https://git.openjdk.org/jdk/pull/27566#discussion_r2416866546
PR Review Comment: https://git.openjdk.org/jdk/pull/27566#discussion_r2416867294
PR Review Comment: https://git.openjdk.org/jdk/pull/27566#discussion_r2416868671
PR Review Comment: https://git.openjdk.org/jdk/pull/27566#discussion_r2416868957

Reply via email to