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

jar tool support to report automatic module names

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: tools
    • Subcomponent:
      jar
    • Resolved In Build:
      b162
    • Verification:
      Verified

      Backports

        Description

        It would be useful for the jar tool to report the automatic module name that would be used if a regular jar file was put on the module path ( so there is an easy way for developers to determine the derived name ).

        One way to achieve this is to repurpose the somewhat fingersome '--print-module-descriptor’ option, to report the automatic module name if the jar file does not contain a module-info.class. Given this, we should then probably give the option a better name, say ‘--describe-module’ ( similar to that of jmod's ‘describe’ subcommand ), e.g.

         $ touch resource
         $ jdk/bin/jar --create --file foo-6.jar resource
         $ jdk/bin/jar --describe-module --file foo-6.jar
         No module descriptor found. Derived automatic module: foo@6

        It is also useful for the jar tool to indicate when a jar is not suitable to use as an automatic module, e.g.

         $ jdk/bin/jar --create --file ttt.jar T.class
         $ jdk/bin/jar --describe-module --file ttt.jar
         Unable to derive module descriptor for: ttt.jar
         T.class found in top-level directory (unnamed package not allowed in module)

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  chegar Chris Hegarty
                  Reporter:
                  chegar Chris Hegarty
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  3 Start watching this issue

                  Dates

                  • Due:
                    Created:
                    Updated:
                    Resolved: