Module java.base
Package java.lang.classfile

# Interface Attribute

≠
public abstract sealed interface Attribute<A>
extends java.lang.classfile.ClassFileElement
permits java.lang.classfile.CustomAttribute<T>, java.lang.classfile.attribute.AnnotationDefaultAttribute, java.lang.classfile.attribute.BootstrapMethodsAttribute, java.lang.classfile.attribute.CharacterRangeTableAttribute, java.lang.classfile.attribute.CodeAttribute, java.lang.classfile.attribute.CompilationIDAttribute, java.lang.classfile.attribute.ConstantValueAttribute, java.lang.classfile.attribute.DeprecatedAttribute, java.lang.classfile.attribute.EnclosingMethodAttribute, java.lang.classfile.attribute.ExceptionsAttribute, java.lang.classfile.attribute.InnerClassesAttribute, java.lang.classfile.attribute.LineNumberTableAttribute, java.lang.classfile.attribute.LoadableDescriptorsAttribute, java.lang.classfile.attribute.LocalVariableTableAttribute, java.lang.classfile.attribute.LocalVariableTypeTableAttribute, java.lang.classfile.attribute.MethodParametersAttribute, java.lang.classfile.attribute.ModuleAttribute, java.lang.classfile.attribute.ModuleHashesAttribute, java.lang.classfile.attribute.ModuleMainClassAttribute, java.lang.classfile.attribute.ModulePackagesAttribute, java.lang.classfile.attribute.ModuleResolutionAttribute, java.lang.classfile.attribute.ModuleTargetAttribute, java.lang.classfile.attribute.NestHostAttribute, java.lang.classfile.attribute.NestMembersAttribute, java.lang.classfile.attribute.PermittedSubclassesAttribute, java.lang.classfile.attribute.RecordAttribute, java.lang.classfile.attribute.RuntimeInvisibleAnnotationsAttribute, java.lang.classfile.attribute.RuntimeInvisibleParameterAnnotationsAttribute, java.lang.classfile.attribute.RuntimeInvisibleTypeAnnotationsAttribute, java.lang.classfile.attribute.RuntimeVisibleAnnotationsAttribute, java.lang.classfile.attribute.RuntimeVisibleParameterAnnotationsAttribute, java.lang.classfile.attribute.RuntimeVisibleTypeAnnotationsAttribute, java.lang.classfile.attribute.SignatureAttribute, java.lang.classfile.attribute.SourceDebugExtensionAttribute, java.lang.classfile.attribute.SourceFileAttribute, java.lang.classfile.attribute.SourceIDAttribute, java.lang.classfile.attribute.StackMapTableAttribute, java.lang.classfile.attribute.SyntheticAttribute, java.lang.classfile.attribute.UnknownAttribute, jdk.internal.classfile.impl.BoundAttribute<T>, jdk.internal.classfile.impl.UnboundAttribute<T>
Comparing jdk-master and valhalla-csr-open

Type Parameters:
  `A` - the attribute type

All Superinterfaces:
  `ClassFileElement`

All Known Subinterfaces:
  `AnnotationDefaultAttribute, BootstrapMethodsAttribute, CharacterRangeTableAttribute, CodeAttribute, CompilationIDAttribute, ConstantValueAttribute, DeprecatedAttribute, EnclosingMethodAttribute, ExceptionsAttribute, InnerClassesAttribute, LineNumberTableAttribute, LoadableDescriptorsAttributePREVIEW , LocalVariableTableAttribute, LocalVariableTypeTableAttribute, MethodParametersAttribute, ModuleAttribute, ModuleHashesAttribute, ModuleMainClassAttribute, ModulePackagesAttribute, ModuleResolutionAttribute, ModuleTargetAttribute, NestHostAttribute, NestMembersAttribute, PermittedSubclassesAttribute, RecordAttribute, RuntimeInvisibleAnnotationsAttribute, RuntimeInvisibleParameterAnnotationsAttribute, RuntimeInvisibleTypeAnnotationsAttribute, RuntimeVisibleAnnotationsAttribute, RuntimeVisibleParameterAnnotationsAttribute, RuntimeVisibleTypeAnnotationsAttribute, SignatureAttribute, SourceDebugExtensionAttribute, SourceFileAttribute, SourceIDAttribute, StackMapTableAttribute, SyntheticAttribute, UnknownAttribute`

All Known Implementing Classes:
  `CustomAttribute`

public sealed interface Attribute<A extends Attribute<A>>AttributePREVIEW <A>> extends ClassFileElement permits AnnotationDefaultAttribute, BootstrapMethodsAttribute, CharacterRangeTableAttribute, CodeAttribute, CompilationIDAttribute, ConstantValueAttribute, DeprecatedAttribute, EnclosingMethodAttribute, ExceptionsAttribute, InnerClassesAttribute, LineNumberTableAttribute, LoadableDescriptorsAttributePREVIEW , LocalVariableTableAttribute, LocalVariableTypeTableAttribute, MethodParametersAttribute, ModuleAttribute, ModuleHashesAttribute, ModuleMainClassAttribute, ModulePackagesAttribute, ModuleResolutionAttribute, ModuleTargetAttribute, NestHostAttribute, NestMembersAttribute, PermittedSubclassesAttribute, RecordAttribute, RuntimeInvisibleAnnotationsAttribute, RuntimeInvisibleParameterAnnotationsAttribute, RuntimeInvisibleTypeAnnotationsAttribute, RuntimeVisibleAnnotationsAttribute, RuntimeVisibleParameterAnnotationsAttribute, RuntimeVisibleTypeAnnotationsAttribute, SignatureAttribute, SourceDebugExtensionAttribute, SourceFileAttribute, SourceIDAttribute, StackMapTableAttribute, SyntheticAttribute, UnknownAttribute, CustomAttribute<T> (not exhaustive)
`Attribute` relies on preview features of the Java platform:

- `Attribute` refers to one or more reflective preview APIs: `LoadableDescriptorsAttribute` .

Programs can only use `Attribute` when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
Models an attribute (JVMS §4.7) in the `class` file format. Attributes exist on certain `class` file structures modeled by `AttributedElement` , which provides basic read access to the attributes.

This sealed interface hierarchy includes attributes predefined in the JVMS and JDK-specific nonstandard attributes. Their mappers are available in `Attributes` . Two special subtypes of `Attribute` are `CustomAttribute` , which all user-defined attributes should extend from, and `UnknownAttribute` , representing attributes read from `class` file but are not recognized by the `ClassFile.AttributeMapperOption` .

Attributes are read through `AttributedElement` or element traversal of a `CompoundElement` ; they are written through `ClassFileBuilder` . See Reading Attributes and Writing Attributes for more details.

See Java Virtual Machine Specification:
  4.7 Attributes
Sealed Class Hierarchy Graph:
Since:
  24
See Also:
  - `java.lang.classfile.attribute`
  - `AttributeMapper`
  - `AttributedElement`
  - `CustomAttribute`
  - `UnknownAttribute`

## Methods

- =
  public abstract java.lang.classfile.AttributeMapper<A> attributeMapper()
- =
  public abstract java.lang.classfile.constantpool.Utf8Entry attributeName()

## Summary

Differences
| Elements | Comments | Descriptions | Total
Added | Changed | Removed | Added | Changed | Removed | Added | Changed | Removed
--- | --- | --- | --- | --- | --- | --- | --- | ---
Attribute |  | 2 |  |  |  |  | 13 | 1 |  | 16
Total |  | 2 |  |  |  |  | 13 | 1 |  | 16