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

Add a --validate option to the jar tool

    XMLWordPrintable

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P3
    • Resolution: Approved
    • Fix Version/s: 17
    • Component/s: tools
    • Labels:
      None
    • Subcomponent:
      jar
    • Compatibility Risk:
      minimal
    • Compatibility Risk Description:
      Minimal to no risk. A new command line option is added, and existing behavior is left as-is
    • Interface Kind:
      add/remove/modify command line option
    • Scope:
      JDK

      Description

      Summary

      Add a --validate option to the jar tool that can be used to validate jar files.

      Problem

      Malformed jar files can lead to weird compilation and binary/source compatibility problems, for instance due to APIs differing across different version in a multi-release jar file.

      While the jdk's jar tool does not produce malformed jar files, a third party tool might, or a jar file might be manually edited after creation.

      It is currently not possible to (re-)run validation logic without updating a target jar file as well.

      Solution

      Add a --validate option to the jar tool, which can be used to directly run the existing validation logic on a given jar file.

      Specification

        --validate             Validate the contents of the jar archive. This option
                               will validate that the API exported by a multi-release
                               jar archive is consistent across all different release
                               versions.

      Furthermore, the error message when a main operation is not specified is updated as well:

      -        One of options -{ctxuid} must be specified.
      +        One of options -{ctxuid} or --validate must be specified.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jvernee Jorn Vernee
              Reporter:
              jvernee Jorn Vernee
              Reviewed By:
              Alan Bateman
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: