Webrev: http://cr.openjdk.java.net/~mchung/jdk9/webrevs/8160286/webrev.00/
jmod and jar -—hash-modules option to specify a pattern of modules to be hashed in the module M being created. It records the modules that depend on M directly and indirectly. jmod hash command records the hashes in modules that have already been packaged. It will identify the base module(s) with no going edges and record the hashes in that module. This patch fixes jmod hash command how the base modules are identified. For example, $ jmod hash -—dry-run —-module-path jmods -—hash-modules "jdk.jdeps|jdk.compiler|java.compiler” java.compiler should be the only module recording the hashes of jdk.compiler and jdk.jdeps. It first builds a graph of the modules matching the pattern specified in the --hash-module option. It traverses the graph in topological order, for each module, it is a base module if it’s a matching module and not hashed and then record the matching modules that directly and indirectly depend on it. This also cleans up the duplicated code and shared by jar and jmod tools now. I found that jar -—module-path is a repeating option and this patch fixes it to be the last-one-wins, consistent with the runtime option, and other tools. Mandy