RFR: 8218685: jlink --list-plugins needs to be readable and tidy [v3]
Mandy Chung
mchung at openjdk.java.net
Thu Sep 24 23:27:40 UTC 2020
On Wed, 23 Sep 2020 17:26:44 GMT, Ian Graves <igraves at openjdk.org> wrote:
>> These changes update the jlink plugin command line documentation to tidy them up into a more canonical form.
>>
>> The output generated by jlink from this change appears as follows:
>>
>>> build/macosx-x64/images/jdk/bin/jlink --list-plugins
>>
>> List of available plugins:
>> --strip-debug Strip debug information from the output image
>> --strip-java-debug-attributes
>> Strip Java debug attributes from classes in the output image
>> --exclude-resources <pattern-list>
>> Specify resources to exclude.
>> e.g.: **.jcov,glob:**/META-INF/**
>> --exclude-files <pattern-list>
>> Specify files to exclude.
>> e.g.: **.java,glob:/java.base/lib/client/**
>> --exclude-jmod-section <section-name>
>> Specify a JMOD section to exclude.
>> Where <section-name> is "man" or "headers".
>> --dedup-legal-notices [error-if-not-same-content]
>> De-duplicate all legal notices.
>> If error-if-not-same-content is specified then
>> it will be an error if two files of the same
>> filename are different.
>> --system-modules retainModuleTarget
>> Fast loading of module descriptors (always enabled)
>> --strip-native-commands Exclude native commands (such as java/java.exe) from the image
>> --order-resources <pattern-list>
>> Order resources.
>> e.g.: **/module-info.class, at classlist,/java.base/java/lang/**
>> --compress <0|1|2>[:filter=<pattern-list>]
>> Compress all resources in the output image.
>> Level 0: No compression
>> Level 1: Constant string sharing
>> Level 2: ZIP.
>> An optional <pattern-list> filter can be
>> specified to list the pattern of files to be included.
>> --vm <client|server|minimal|all>
>> Select the HotSpot VM in the output image. Default is all
>> --include-locales <langtag>[,<langtag>]*
>> BCP 47 language tags separated by a comma, allowing
>> locale matching defined in RFC 4647. e.g.: en,ja,*-IN
>> --generate-jli-classes @filename
>> Specify a file listing the java.lang.invoke classes
>> to pre-generate. By default, this plugin may use a
>> builtin list of classes to pre-generate. If this plugin
>> runs on a different runtime version than the image being
>> created then code generation will be disabled by
>> default to guarantee correctness
>> add ignore-version=true to override this.
>> --release-info <file>|add:<key1>=<value1>:<key2>=<value2>:...|del:<key list>
>> <file> option is to load release properties from the supplied file.
>> add: is to add properties to the release file.
>> Any number of <key>=<value> pairs can be passed.
>> del: is to delete the list of keys in release file.
>> --add-options <options> Prepend the specified <options> string, which may
>> include whitespace, before any other options when
>> invoking the virtual machine in the resulting image.
>> --vendor-bug-url <vendor-bug-url>
>> Override the vendor bug URL baked into the build.
>> The value of the system property
>> "java.vendor.url.bug" will be <vendor-url-bug>.
>> --vendor-vm-bug-url <vendor-vm-bug-url>
>> Override the vendor VM bug URL baked into the build.
>> The URL displayed in VM error logs will be <vendor-vm-bug-url>.
>> --vendor-version <vendor-version>
>> Override the vendor version string baked into the build,
>> if any. The value of the system property
>> "java.vendor.version" will be <vendor-version>.
>>
>> For options requiring a <pattern-list>, the value will be a comma separated
>> list of elements each using one the following forms:
>> <glob-pattern>
>> glob:<glob-pattern>
>> regex:<regex-pattern>
>> @<filename> where filename is the name of a file containing patterns to be
>> used, one pattern per line
>
> Ian Graves has updated the pull request incrementally with one additional commit since the last revision:
>
> Consolidate documentation methods to abstract base class DocumentPlugin
I suggest to update the PR description with the new `jlink --show-plugins` output.
src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java line 33:
> 31: import java.nio.file.Paths;
> 32: import java.text.MessageFormat;
> 33: import java.util.*;
I assume this change is unintentional. Probably IDE converted the single-class imports to this.
src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/DocumentedPlugin.java line 5:
> 3: import jdk.tools.jlink.plugin.Plugin;
> 4:
> 5: public abstract class DocumentedPlugin implements Plugin {
I agree with Alan that `AbstractPlugin` is better.
This should also provide the default implementation of `getArgumentsDescription()` such that the plugins don't need to
implement.
src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/DocumentedPlugin.java line 7:
> 5: public abstract class DocumentedPlugin implements Plugin {
> 6:
> 7: private final String NAME;
Nit: use lowercase for final instance field name.
src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/OrderResourcesPlugin.java line 50:
> 48: */
> 49: public final class OrderResourcesPlugin extends DocumentedPlugin {
> 50: public static final String NAME = "order-resources";
This is not related to your change. It can be private static final field. In my past observation, this static final
NAME field is defined in every plugin which isn't really a need for it (at least in the current implementation). It
might be good to consider the clean up to remove this static final field and instead call `getName()` to get the name.
Just a thought.
-------------
PR: https://git.openjdk.java.net/jdk/pull/305
More information about the core-libs-dev
mailing list