Summary
Add jlink
option --strip-java-debug-attributes
. Currently the same behaviour is available via option --strip-debug
, which might gain additional functionality, such as stripping native debug symbols, in the future.
Problem
While working on JDK-8214796, which introduces a mechanism for stripping native debug symbols from executables and shared libraries, it was observed that there exists a more generic --strip-debug
option already. However, that version currently only strips Java debug attributes from class files. For one, the current --strip-debug
option seems misleading as it's not clear which debug information is actually being stripped. That's the reason why it was suggested to move the current --strip-debug
plugin functionality to a more telling name, --strip-java-debug-attributes
. This would then open up the possibility of --strip-debug
to perform more than just Java debug attributes stripping. One such candidate of additional stripping performed by --strip-debug
would be stripping of native debug symbols from executables and shared libraries.
Solution
The proposed solution moves current functionality of stripping Java debug attributes from class files to a new plugin, invoked via --strip-java-debug-attributes
. Initially, --strip-debug
will delegate to --strip-java-debug-attributes
. In a future version --strip-debug
might also invoke a plugin for native debug symbols stripping (See JDK-8214796).
An alternative solution would be to keep --strip-debug
as is and only add --strip-native-debug-symbols
via JDK-8214796. This has the drawback of not being able to implement --strip-debug
as a compound command to invoke both, --strip-debug
and --strip-native-debug-symbols
as well as it being not very clear. --strip-debug
help keeps its workings rather broad via its description: "Strip debug information from the output image". It seems misleading to only strip Java debug attributes for an implementation of this plugin.
References to relevant review discussions:
--strip-debug
inconsistency is being noted here:
http://mail.openjdk.java.net/pipermail/jigsaw-dev/2019-February/014118.html
Rename of --strip-debug
is being suggested as a pre-requisite of --strip-native-debug-symbols
here:
http://mail.openjdk.java.net/pipermail/jigsaw-dev/2019-February/014118.html
Specification
jlink
's --list-plugins
output will include this output for --strip-java-debug-attributes
:
Plugin Name: strip-java-debug-attributes
Option: --strip-java-debug-attributes
Description: Strip Java debug attributes from classes in the output image
--strip-debug
help output will remain as is:
Plugin Name: strip-debug
Option: --strip-debug
Description: Strip debug information from the output image
- csr of
-
JDK-8218913 Rename --strip-debug jlink plugin
-
- Resolved
-