Interface ModuleResolutionAttribute

All Superinterfaces:
AttributePREVIEW<ModuleResolutionAttributePREVIEW>, ClassElementPREVIEW, ClassFileElementPREVIEW

public sealed interface ModuleResolutionAttribute extends AttributePREVIEW<ModuleResolutionAttributePREVIEW>, ClassElementPREVIEW
ModuleResolutionAttribute is a preview API of the Java platform.
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 ClassElementPREVIEW when traversing the elements of a ClassModelPREVIEW.

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 Details

    • resolutionFlags

      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:
      the module resolution flags
    • of

      static ModuleResolutionAttributePREVIEW of(int resolutionFlags)
      Returns a ModuleResolution attribute.
      Parameters:
      resolutionFlags - the resolution flags
      Returns:
      a ModuleResolution attribute