API for determining the hash of a module

Alan Bateman alan.bateman at oracle.com
Sat Dec 14 08:20:01 UTC 2024


On 14/12/2024 08:02, Ethan McCue wrote:
> Hi all,
>
> Not sure if this is best for core-libs or langtools, but best I can 
> tell there is no way to determine the hash of a module programmatically.

The hashes you found are a JDK-specific feature so you there isn't a 
standard API exposed. Hashes are used to detect accidental mixing of 
tightly coupled modules from different builds, mostly at link time (as 
in the jlink tool). The jar tool can generate hashes too so it is 
possible to have hashes for tightly coupled modules that are packaged as 
modular JAR files, and have the hashes checked at runtime.

I wouldn't expect programs to interact with modules hashes so I'm 
curious what you are doing.

-Alan


More information about the core-libs-dev mailing list