APIdia Launch Partner
Top Description Methods
java.lang.classfile.attribute

public sealed Interface ModuleResolutionAttribute

extends Attribute<ModuleResolutionAttribute>, ClassElement
permits BoundModuleResolutionAttribute, UnboundModuleResolutionAttribute
Known Direct Implementers
jdk.internal.classfile.impl.BoundAttribute.BoundModuleResolutionAttribute, jdk.internal.classfile.impl.UnboundAttribute.UnboundModuleResolutionAttribute
Imports
java.lang.classfile.Attribute, .AttributeMapper, .AttributeMapper.AttributeStability, .Attributes, .ClassElement, .ClassModel, jdk.internal.classfile.impl.BoundAttribute, .UnboundAttribute

Models the ModuleResolution attribute, which can appear on classes that represent module descriptors, to capture resolution metadata for modules.

The specification of the ModuleResolution attribute is:

 ModuleResolution_attribute {
   u2 attribute_name_index;    // "ModuleResolution"
   u4 attribute_length;        // 2
   u2 resolution_flags;

 The value of the resolution_flags item is a mask of flags used to denote
 properties of module resolution. The flags are as follows:

  // Optional
  0x0001 (DO_NOT_RESOLVE_BY_DEFAULT)

  // At most one of:
  0x0002 (WARN_DEPRECATED)
  0x0004 (WARN_DEPRECATED_FOR_REMOVAL)
  0x0008 (WARN_INCUBATING)
 }
 

This attribute only appears on classes, and does not permit multiple instances in a class. It has no data dependency.

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.

Since
24
See Also
Attributes#moduleResolution(), ModuleHashesAttribute, ModuleTargetAttribute

Method Summary

Modifier and TypeMethod and Description
public static ModuleResolutionAttribute

Returns:

a ModuleResolution attribute
of
(int
the resolution flags
resolutionFlags
)

Returns a ModuleResolution attribute.

public int

Returns:

the module resolution flags
resolutionFlags
()

Returns the module resolution flags.

Inherited from java.lang.classfile.Attribute:
attributeMapperattributeName

Method Detail

ofback to summary
public static ModuleResolutionAttribute of(int resolutionFlags)

Returns a ModuleResolution attribute.

Parameters
resolutionFlags:int

the resolution flags

Returns:ModuleResolutionAttribute

a ModuleResolution attribute

Exceptions
IllegalArgumentException:
if resolutionFlags is not u2
resolutionFlagsback to summary
public int resolutionFlags()

Returns the module resolution flags. It is a u2 value.

The value of the resolution_flags item is a mask of flags used to denote properties of module resolution. The flags are as follows:

 // Optional
  0x0001 (DO_NOT_RESOLVE_BY_DEFAULT)

  // At most one of:
  0x0002 (WARN_DEPRECATED)
  0x0004 (WARN_DEPRECATED_FOR_REMOVAL)
  0x0008 (WARN_INCUBATING)
  
Returns:int

the module resolution flags