Attribute<ModuleHashesAttribute>, ClassElement, ClassFileElementpublic sealed interface ModuleHashesAttribute extends Attribute<ModuleHashesAttribute>, ClassElement
ModuleHashes attribute, which appears on classes that represent module descriptors to capture the hashes of a set of co-delivered modules. The specification of the ModuleHashes attribute is:
ModuleHashes_attribute {
// index to CONSTANT_utf8_info structure in constant pool representing
// the string "ModuleHashes"
u2 attribute_name_index;
u4 attribute_length;
// index to CONSTANT_utf8_info structure with algorithm name
u2 algorithm_index;
// the number of entries in the hashes table
u2 hashes_count;
{ u2 module_name_index (index to CONSTANT_Module_info structure)
u2 hash_length;
u1 hash[hash_length];
} hashes[hashes_count];
}
This attribute only appears on classes, and does not permit multiple instances in a class. It has a data dependency on the constant pool.
This attribute is not predefined in the Java SE Platform. This is a JDK-specific nonstandard attribute produced by the jdk.jlink module, which defines the jlink and jmod tools.
| Modifier and Type | Method | Description |
|---|---|---|
Utf8Entry |
algorithm() |
Returns the algorithm name used to compute the hash. |
List |
hashes() |
Returns the hash information about related modules. |
static ModuleHashesAttribute |
of |
Returns a ModuleHashes attribute. |
static ModuleHashesAttribute |
of |
Returns a ModuleHashes attribute. |
static ModuleHashesAttribute |
of |
Returns a ModuleHashes attribute. |
static ModuleHashesAttribute |
of |
Returns a ModuleHashes attribute. |
attributeMapper, attributeName
Utf8Entry algorithm()
List<ModuleHashInfo> hashes()
static ModuleHashesAttribute of(String algorithm, List<ModuleHashInfo> hashes)
ModuleHashes attribute.algorithm - the hashing algorithmhashes - the hash descriptionsModuleHashes attributestatic ModuleHashesAttribute of(String algorithm, ModuleHashInfo... hashes)
ModuleHashes attribute.algorithm - the hashing algorithmhashes - the hash descriptionsModuleHashes attributestatic ModuleHashesAttribute of(Utf8Entry algorithm, List<ModuleHashInfo> hashes)
ModuleHashes attribute.algorithm - the hashing algorithmhashes - the hash descriptionsModuleHashes attributestatic ModuleHashesAttribute of(Utf8Entry algorithm, ModuleHashInfo... hashes)
ModuleHashes attribute.algorithm - the hashing algorithmhashes - the hash descriptionsModuleHashes attribute
© 1993, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/classfile/attribute/ModuleHashesAttribute.html