Details

    • Type: Sub-task
    • Status: Closed
    • Priority: P3
    • Resolution: Withdrawn
    • Affects Version/s: 9
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
      None
    • Verification:
      Verified

      Description

      The javap tool must be updated to enable selection of versioned class files.

      Currently
           $ javap -cp version.jar version.Version

      will display the attributes of the base entry in a multi-release jar file (i.e. version/Version.class). If one wants to inspect versioned entries they need to specifically request a class through a jar url as in

           $ javap jar:file:version.jar\!/META-INF/versions/9/version/Version.class

      What we'd like to do is add a command line option to select the appropriate version of the class.

      It turns out that javap already has such a command line option, -multi-release. So one can select appropriate classes like this:

          $ javap -cp version.jar version.Version (for the base version)
          $ javap -cp version.jar -multi-release 9 version.Version (for the jdk 9 version)
          $ javap -cp version.jar -multi-release runtime version.Version (also for the jdk 9 version since runtime is equivalent to 9 on jdk 9)

      So all we really need to do is to document the option.

        Issue Links

          Activity

          Hide
          sdrach Steve Drach (Inactive) added a comment -
          Updating javap to be multi-release jar aware is not recommended. The use case in the description

          $ javap -cp version.jar version.Version

          should display the attributes for the base entry. Making javap multi-release aware would mean that the above use case could display different results depending on whether it's run on JDK 9 or JDK 10. That would be clearly confusing. It's best to always display a consistent result, that associated with the base class.

          Furthermore, the use case above is considered not a significant use case, and it's application is not recommended. Use a jar: URL scheme to directly address the desired class file in a multi-release jar. For example, use the following forms instead.

          $ javap jar:file:version.jar\!/version/Version.class
          $ javap jar:file:version.jar\!/META-INF/versions/9/version/Version.class


          Show
          sdrach Steve Drach (Inactive) added a comment - Updating javap to be multi-release jar aware is not recommended. The use case in the description $ javap -cp version.jar version.Version should display the attributes for the base entry. Making javap multi-release aware would mean that the above use case could display different results depending on whether it's run on JDK 9 or JDK 10. That would be clearly confusing. It's best to always display a consistent result, that associated with the base class. Furthermore, the use case above is considered not a significant use case, and it's application is not recommended. Use a jar: URL scheme to directly address the desired class file in a multi-release jar. For example, use the following forms instead. $ javap jar:file:version.jar\!/version/Version.class $ javap jar:file:version.jar\!/META-INF/versions/9/version/Version.class
          Hide
          sdrach Steve Drach (Inactive) added a comment -
          The class path semantics for javap are not a significant use case.
          Show
          sdrach Steve Drach (Inactive) added a comment - The class path semantics for javap are not a significant use case.

            People

            • Assignee:
              sdrach Steve Drach (Inactive)
              Reporter:
              sdrach Steve Drach (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: