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

Add a --validate option to the jar tool

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P3 P3
    • 17
    • tools
    • None
    • jar
    • minimal
    • Minimal to no risk. A new command line option is added, and existing behavior is left as-is
    • add/remove/modify command line option
    • JDK

      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.

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

              Created:
              Updated:
              Resolved: