<div dir="ltr">I am experimenting with making a package repository where modules are the artifacts (bundled as JMODs) and not jars. In this context we lack information about what version a particular module requires or what provider to get that module from. What I *can* do is say "if you use this java.base, you must use this java.xml" and so on, but given a two java.xml modules I can't say without those hashes which one you are allowed to use when constructing a "module set".<br><br>This is relevant also if someone uploads some of their own modules where the hashes don't line up.<br></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Sat, Dec 14, 2024 at 12:20 AM Alan Bateman <<a href="mailto:alan.bateman@oracle.com">alan.bateman@oracle.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 14/12/2024 08:02, Ethan McCue wrote:<br>
> Hi all,<br>
><br>
> Not sure if this is best for core-libs or langtools, but best I can <br>
> tell there is no way to determine the hash of a module programmatically.<br>
<br>
The hashes you found are a JDK-specific feature so you there isn't a <br>
standard API exposed. Hashes are used to detect accidental mixing of <br>
tightly coupled modules from different builds, mostly at link time (as <br>
in the jlink tool). The jar tool can generate hashes too so it is <br>
possible to have hashes for tightly coupled modules that are packaged as <br>
modular JAR files, and have the hashes checked at runtime.<br>
<br>
I wouldn't expect programs to interact with modules hashes so I'm <br>
curious what you are doing.<br>
<br>
-Alan<br>
</blockquote></div>