Top Description Methods
java.lang.classfile.attribute

public sealed Interface ModuleResolutionAttribute

extends Attribute<ModuleResolutionAttribute>, ClassElement
Known Direct Implementers
jdk.internal.classfile.impl.BoundAttribute.BoundModuleResolutionAttribute, jdk.internal.classfile.impl.UnboundAttribute.UnboundModuleResolutionAttribute
Annotations
@PreviewFeature
feature:CLASSFILE_API
Imports
java.lang.classfile.Attribute, .ClassElement, jdk.internal.classfile.impl.BoundAttribute, .UnboundAttribute, jdk.internal.javac.PreviewFeature

Preview

Second Preview of ClassFile API (JEP 466).

Programs can only use ModuleResolutionAttribute when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.

Models the ModuleResolution attribute, which can appear on classes that represent module descriptors. This is a JDK-specific * attribute, which captures resolution metadata for modules. Delivered as a java.lang.classfile.ClassElement when traversing the elements of a java.lang.classfile.ClassModel.

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)
 }
 

The attribute does not permit multiple instances in a given location. Subsequent occurrence of the attribute takes precedence during the attributed element build or transformation.

Since
22

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
()

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

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

resolutionFlagsback to summary
public int resolutionFlags()

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