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

jar tool support to report automatic module names

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 9
    • 9
    • tools
    • jar
    • b162
    • Verified

        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)

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

                Created:
                Updated:
                Resolved: