Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8218761

Allow for optional arguments for jlink plugins options

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: New
    • Priority: P3
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: tools
    • Labels:
      None
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      Right now only 1+ arguments XOR 0 arguments are possible for jlink plugins. Sometimes it's useful to allow optional arguments for plugin options so as to override defaults the jlink plugin uses. Example case is JDK-8214796 which adds a plugin for stripping native debug symbols from executables/shared libraries. However, a soon as Plugin.hasArgument() returns true there is no way to *not* provide an argument:

      $ ./build/linux-x86_64-server-release/images/jdk/bin/jlink --strip-native-debug-symbols --add-modules java.base --output custom-image --verbose
      Error: no value given for --strip-native-debug-symbols
      Usage: jlink <options> --module-path <modulepath> --add-modules <module>[,<module>...]
      Use --help for a list of possible options

      Yet, this works:
      $ ./build/linux-x86_64-server-release/images/jdk/bin/jlink --strip-native-debug-symbols defaults --add-modules java.base --output custom-image --verbose

      The error check related to arguments seems to be coming from this code:
      http://hg.openjdk.java.net/jdk/jdk/file/3e451bff6f7f/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java#l560

      There is a check for opt.hasArg() == true which, in turn, is determined by Plugin.hasArguments():
      http://hg.openjdk.java.net/jdk/jdk/file/3e451bff6f7f/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/TaskHelper.java#l312

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            sgehwolf Severin Gehwolf
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: