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

Enhance java.util.spi.ToolProvider

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 18
    • Fix Version/s: 19
    • Component/s: core-libs
    • Labels:
      None

      Description

      This is a list of potential enhancements to the ToolProvider API.

      1. Provide 1 or 2 static methods to expand @-files. These would be similar to the public methods on the internal `CommandLine` class, which now exists in 3 separate places. If there was only one method, it might be

         public static List<String> expandArgumentFiles(List<String> args)

      If there was an additional method, it might be to support an environment variable, as in

         public static List<String> expandArgumentFiles(String envVar, List<String> args)

      For reference, see
      https://github.com/openjdk/jdk/blob/master/src/jdk.compiler/share/classes/com/sun/tools/javac/main/CommandLine.java

      Internally, this might be implemented by adding `CommandLine` as an internal nested class of ToolProvider, with just a public static method to invoke it.


      2. Provide a new default method on ToolProvider:

          /**
           * {@return a short one-line description of the tool,
           * or an empty {@code Optional} if no description is available}
           */
          default Optional<String> description() { return Optional.empty(); }

      Why Optional<String> as the return type (and not null or an empty string)? To match the existing pattern of the findFirst factory method.

      3. Provide an `@apiNote` on ToolProvider, encouraging (but not requiring)
         tools to support `--help` and `--version` options, which write to the standard output stream
         that is provided when invoking the `run` method.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              cstein Christian Stein
              Reporter:
              jjg Jonathan Gibbons
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated: