Class Attributes
java.lang.Object
java.lang.classfile.Attributes
public final class Attributes extends Object
Attribute mappers for predefined (JVMS 4.7) and JDK-specific nonstandard attributes.
Unless otherwise specified, each mapper returned by methods in this class:
- is predefined in the JVMS instead of JDK-specific;
- does not permit multiple attribute instances in the same structure;
- the attribute has a data dependency on the constant pool.
- Since:
- 24
- See Also:
Field Summary
| Modifier and Type | Field | Description |
|---|---|---|
static final String |
NAME_ANNOTATION_DEFAULT |
AnnotationDefault |
static final String |
NAME_BOOTSTRAP_METHODS |
BootstrapMethods |
static final String |
NAME_CHARACTER_RANGE_TABLE |
CharacterRangeTable |
static final String |
NAME_CODE |
Code |
static final String |
NAME_COMPILATION_ID |
CompilationID |
static final String |
NAME_CONSTANT_VALUE |
ConstantValue |
static final String |
NAME_DEPRECATED |
Deprecated |
static final String |
NAME_ENCLOSING_METHOD |
EnclosingMethod |
static final String |
NAME_EXCEPTIONS |
Exceptions |
static final String |
NAME_INNER_CLASSES |
InnerClasses |
static final String |
NAME_LINE_NUMBER_TABLE |
LineNumberTable |
static final String |
NAME_LOCAL_VARIABLE_TABLE |
LocalVariableTable |
static final String |
NAME_LOCAL_VARIABLE_TYPE_TABLE |
LocalVariableTypeTable |
static final String |
NAME_METHOD_PARAMETERS |
MethodParameters |
static final String |
NAME_MODULE |
Module |
static final String |
NAME_MODULE_HASHES |
ModuleHashes |
static final String |
NAME_MODULE_MAIN_CLASS |
ModuleMainClass |
static final String |
NAME_MODULE_PACKAGES |
ModulePackages |
static final String |
NAME_MODULE_RESOLUTION |
ModuleResolution |
static final String |
NAME_MODULE_TARGET |
ModuleTarget |
static final String |
NAME_NEST_HOST |
NestHost |
static final String |
NAME_NEST_MEMBERS |
NestMembers |
static final String |
NAME_PERMITTED_SUBCLASSES |
PermittedSubclasses |
static final String |
NAME_RECORD |
Record |
static final String |
NAME_RUNTIME_INVISIBLE_ANNOTATIONS |
RuntimeInvisibleAnnotations |
static final String |
NAME_RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS |
RuntimeInvisibleParameterAnnotations |
static final String |
NAME_RUNTIME_INVISIBLE_TYPE_ANNOTATIONS |
RuntimeInvisibleTypeAnnotations |
static final String |
NAME_RUNTIME_VISIBLE_ANNOTATIONS |
RuntimeVisibleAnnotations |
static final String |
NAME_RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS |
RuntimeVisibleParameterAnnotations |
static final String |
NAME_RUNTIME_VISIBLE_TYPE_ANNOTATIONS |
RuntimeVisibleTypeAnnotations |
static final String |
NAME_SIGNATURE |
Signature |
static final String |
NAME_SOURCE_DEBUG_EXTENSION |
SourceDebugExtension |
static final String |
NAME_SOURCE_FILE |
SourceFile |
static final String |
NAME_SOURCE_ID |
SourceID |
static final String |
NAME_STACK_MAP_TABLE |
StackMapTable |
static final String |
NAME_SYNTHETIC |
Synthetic |
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
static AttributeMapper |
annotationDefault() |
Returns the mapper for the AnnotationDefault attribute. |
static AttributeMapper |
bootstrapMethods() |
Returns the mapper for the BootstrapMethods attribute. |
static AttributeMapper |
characterRangeTable() |
Returns the mapper for the CharacterRangeTable attribute. |
static AttributeMapper |
code() |
Returns the mapper for the Code attribute. |
static AttributeMapper |
compilationId() |
Returns the mapper for the CompilationID attribute. |
static AttributeMapper |
constantValue() |
Returns the mapper for the ConstantValue attribute. |
static AttributeMapper |
deprecated() |
Returns the mapper for the Deprecated attribute. |
static AttributeMapper |
enclosingMethod() |
Returns the mapper for the EnclosingMethod attribute. |
static AttributeMapper |
exceptions() |
Returns the mapper for the Exceptions attribute. |
static AttributeMapper |
innerClasses() |
Returns the mapper for the InnerClasses attribute. |
static AttributeMapper |
lineNumberTable() |
Returns the mapper for the LineNumberTable attribute. |
static AttributeMapper |
localVariableTable() |
Returns the mapper for the LocalVariableTable attribute. |
static AttributeMapper |
localVariableTypeTable() |
Returns the mapper for the LocalVariableTypeTable attribute. |
static AttributeMapper |
methodParameters() |
Returns the mapper for the MethodParameters attribute. |
static AttributeMapper |
module() |
Returns the mapper for the Module attribute. |
static AttributeMapper |
moduleHashes() |
Returns the mapper for the ModuleHashes attribute. |
static AttributeMapper |
moduleMainClass() |
Returns the mapper for the ModuleMainClass attribute. |
static AttributeMapper |
modulePackages() |
Returns the mapper for the ModulePackages attribute. |
static AttributeMapper |
moduleResolution() |
Returns the mapper for the ModuleResolution attribute. |
static AttributeMapper |
moduleTarget() |
Returns the mapper for the ModuleTarget attribute. |
static AttributeMapper |
nestHost() |
Returns the mapper for the NestHost attribute. |
static AttributeMapper |
nestMembers() |
Returns the mapper for the NestMembers attribute. |
static AttributeMapper |
permittedSubclasses() |
Returns the mapper for the PermittedSubclasses attribute. |
static AttributeMapper |
record() |
Returns the mapper for the Record attribute. |
static AttributeMapper |
runtimeInvisibleAnnotations() |
Returns the mapper for the RuntimeInvisibleAnnotations attribute. |
static AttributeMapper |
runtimeInvisibleParameterAnnotations() |
Returns the mapper for the RuntimeInvisibleParameterAnnotations attribute. |
static AttributeMapper |
runtimeInvisibleTypeAnnotations() |
Returns the mapper for the RuntimeInvisibleTypeAnnotations attribute. |
static AttributeMapper |
runtimeVisibleAnnotations() |
Returns the mapper for the RuntimeVisibleAnnotations attribute. |
static AttributeMapper |
runtimeVisibleParameterAnnotations() |
Returns the mapper for the RuntimeVisibleParameterAnnotations attribute. |
static AttributeMapper |
runtimeVisibleTypeAnnotations() |
Returns the mapper for the RuntimeVisibleTypeAnnotations attribute. |
static AttributeMapper |
signature() |
Returns the mapper for the Signature attribute. |
static AttributeMapper |
sourceDebugExtension() |
Returns the mapper for the SourceDebugExtension attribute. |
static AttributeMapper |
sourceFile() |
Returns the mapper for the SourceFile attribute. |
static AttributeMapper |
sourceId() |
Returns the mapper for the SourceID attribute. |
static AttributeMapper |
stackMapTable() |
Returns the mapper for the StackMapTable attribute. |
static AttributeMapper |
synthetic() |
Returns the mapper for the Synthetic attribute. |
Field Details
NAME_ANNOTATION_DEFAULT
public static final String NAME_ANNOTATION_DEFAULT
AnnotationDefault
- See Also:
NAME_BOOTSTRAP_METHODS
public static final String NAME_BOOTSTRAP_METHODS
BootstrapMethods
- See Also:
NAME_CHARACTER_RANGE_TABLE
public static final String NAME_CHARACTER_RANGE_TABLE
CharacterRangeTable
- See Also:
NAME_CODE
public static final String NAME_CODE
Code
- See Also:
NAME_COMPILATION_ID
public static final String NAME_COMPILATION_ID
CompilationID
- See Also:
NAME_CONSTANT_VALUE
public static final String NAME_CONSTANT_VALUE
ConstantValue
- See Also:
NAME_DEPRECATED
public static final String NAME_DEPRECATED
Deprecated
- See Also:
NAME_ENCLOSING_METHOD
public static final String NAME_ENCLOSING_METHOD
EnclosingMethod
- See Also:
NAME_EXCEPTIONS
public static final String NAME_EXCEPTIONS
Exceptions
- See Also:
NAME_INNER_CLASSES
public static final String NAME_INNER_CLASSES
InnerClasses
- See Also:
NAME_LINE_NUMBER_TABLE
public static final String NAME_LINE_NUMBER_TABLE
LineNumberTable
- See Also:
NAME_LOCAL_VARIABLE_TABLE
public static final String NAME_LOCAL_VARIABLE_TABLE
LocalVariableTable
- See Also:
NAME_LOCAL_VARIABLE_TYPE_TABLE
public static final String NAME_LOCAL_VARIABLE_TYPE_TABLE
LocalVariableTypeTable
- See Also:
NAME_METHOD_PARAMETERS
public static final String NAME_METHOD_PARAMETERS
MethodParameters
- See Also:
NAME_MODULE
public static final String NAME_MODULE
Module
- See Also:
NAME_MODULE_HASHES
public static final String NAME_MODULE_HASHES
ModuleHashes
- See Also:
NAME_MODULE_MAIN_CLASS
public static final String NAME_MODULE_MAIN_CLASS
ModuleMainClass
- See Also:
NAME_MODULE_PACKAGES
public static final String NAME_MODULE_PACKAGES
ModulePackages
- See Also:
NAME_MODULE_RESOLUTION
public static final String NAME_MODULE_RESOLUTION
ModuleResolution
- See Also:
NAME_MODULE_TARGET
public static final String NAME_MODULE_TARGET
ModuleTarget
- See Also:
NAME_NEST_HOST
public static final String NAME_NEST_HOST
NestHost
- See Also:
NAME_NEST_MEMBERS
public static final String NAME_NEST_MEMBERS
NestMembers
- See Also:
NAME_PERMITTED_SUBCLASSES
public static final String NAME_PERMITTED_SUBCLASSES
PermittedSubclasses
- See Also:
NAME_RECORD
public static final String NAME_RECORD
Record
- See Also:
NAME_RUNTIME_INVISIBLE_ANNOTATIONS
public static final String NAME_RUNTIME_INVISIBLE_ANNOTATIONS
RuntimeInvisibleAnnotations
- See Also:
NAME_RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS
public static final String NAME_RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS
RuntimeInvisibleParameterAnnotations
- See Also:
NAME_RUNTIME_INVISIBLE_TYPE_ANNOTATIONS
public static final String NAME_RUNTIME_INVISIBLE_TYPE_ANNOTATIONS
RuntimeInvisibleTypeAnnotations
- See Also:
NAME_RUNTIME_VISIBLE_ANNOTATIONS
public static final String NAME_RUNTIME_VISIBLE_ANNOTATIONS
RuntimeVisibleAnnotations
- See Also:
NAME_RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS
public static final String NAME_RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS
RuntimeVisibleParameterAnnotations
- See Also:
NAME_RUNTIME_VISIBLE_TYPE_ANNOTATIONS
public static final String NAME_RUNTIME_VISIBLE_TYPE_ANNOTATIONS
RuntimeVisibleTypeAnnotations
- See Also:
NAME_SIGNATURE
public static final String NAME_SIGNATURE
Signature
- See Also:
NAME_SOURCE_DEBUG_EXTENSION
public static final String NAME_SOURCE_DEBUG_EXTENSION
SourceDebugExtension
- See Also:
NAME_SOURCE_FILE
public static final String NAME_SOURCE_FILE
SourceFile
- See Also:
NAME_SOURCE_ID
public static final String NAME_SOURCE_ID
SourceID
- See Also:
NAME_STACK_MAP_TABLE
public static final String NAME_STACK_MAP_TABLE
StackMapTable
- See Also:
NAME_SYNTHETIC
public static final String NAME_SYNTHETIC
Synthetic
- See Also:
Method Details
annotationDefault
public static AttributeMapper<AnnotationDefaultAttribute> annotationDefault()
Returns the mapper for the
AnnotationDefault attribute.- Returns:
- the mapper for the
AnnotationDefaultattribute
bootstrapMethods
public static AttributeMapper<BootstrapMethodsAttribute> bootstrapMethods()
Returns the mapper for the
BootstrapMethods attribute.- Returns:
- the mapper for the
BootstrapMethodsattribute
characterRangeTable
public static AttributeMapper<CharacterRangeTableAttribute> characterRangeTable()
Returns the mapper for the
CharacterRangeTable attribute. This is a JDK-specific attribute. The mapper permits multiple instances in a Code attribute, but this attribute should be only emitted once. This has a data dependency on labels.- Returns:
- the mapper for the
CharacterRangeTableattribute
code
public static AttributeMapper<CodeAttribute> code()
Returns the mapper for the
Code attribute.- Returns:
- the mapper for the
Codeattribute
compilationId
public static AttributeMapper<CompilationIDAttribute> compilationId()
Returns the mapper for the
CompilationID attribute. This is a JDK-specific attribute.- Returns:
- the mapper for the
CompilationIDattribute
constantValue
public static AttributeMapper<ConstantValueAttribute> constantValue()
Returns the mapper for the
ConstantValue attribute.- Returns:
- the mapper for the
ConstantValueattribute
deprecated
public static AttributeMapper<DeprecatedAttribute> deprecated()
Returns the mapper for the
Deprecated attribute. The mapper permits multiple instances in a given location. This has no data dependency.- Returns:
- the mapper for the
Deprecatedattribute
enclosingMethod
public static AttributeMapper<EnclosingMethodAttribute> enclosingMethod()
Returns the mapper for the
EnclosingMethod attribute.- Returns:
- the mapper for the
EnclosingMethodattribute
exceptions
public static AttributeMapper<ExceptionsAttribute> exceptions()
Returns the mapper for the
Exceptions attribute.- Returns:
- the mapper for the
Exceptionsattribute
innerClasses
public static AttributeMapper<InnerClassesAttribute> innerClasses()
Returns the mapper for the
InnerClasses attribute.- Returns:
- the mapper for the
InnerClassesattribute
lineNumberTable
public static AttributeMapper<LineNumberTableAttribute> lineNumberTable()
Returns the mapper for the
LineNumberTable attribute. The mapper permits multiple instances in a Code attribute. This has a data dependency on labels.- Returns:
- the mapper for the
LineNumberTableattribute
localVariableTable
public static AttributeMapper<LocalVariableTableAttribute> localVariableTable()
Returns the mapper for the
LocalVariableTable attribute. The mapper permits multiple instances in a Code attribute. This has a data dependency on labels.- Returns:
- the mapper for the
LocalVariableTableattribute
localVariableTypeTable
public static AttributeMapper<LocalVariableTypeTableAttribute> localVariableTypeTable()
Returns the mapper for the
LocalVariableTypeTable attribute. The mapper permits multiple instances in a given location. This has a data dependency on labels.- Returns:
- the mapper for the
LocalVariableTypeTableattribute
methodParameters
public static AttributeMapper<MethodParametersAttribute> methodParameters()
Returns the mapper for the
MethodParameters attribute.- Returns:
- the mapper for the
MethodParametersattribute
module
public static AttributeMapper<ModuleAttribute> module()
Returns the mapper for the
Module attribute.- Returns:
- the mapper for the
Moduleattribute
moduleHashes
public static AttributeMapper<ModuleHashesAttribute> moduleHashes()
Returns the mapper for the
ModuleHashes attribute. This is a JDK-specific attribute.- Returns:
- the mapper for the
ModuleHashesattribute
moduleMainClass
public static AttributeMapper<ModuleMainClassAttribute> moduleMainClass()
Returns the mapper for the
ModuleMainClass attribute.- Returns:
- the mapper for the
ModuleMainClassattribute
modulePackages
public static AttributeMapper<ModulePackagesAttribute> modulePackages()
Returns the mapper for the
ModulePackages attribute.- Returns:
- the mapper for the
ModulePackagesattribute
moduleResolution
public static AttributeMapper<ModuleResolutionAttribute> moduleResolution()
Returns the mapper for the
ModuleResolution attribute. This is a JDK-specific attribute. This has no data dependency.- Returns:
- the mapper for the
ModuleResolutionattribute
moduleTarget
public static AttributeMapper<ModuleTargetAttribute> moduleTarget()
Returns the mapper for the
ModuleTarget attribute. This is a JDK-specific attribute.- Returns:
- the mapper for the
ModuleTargetattribute
nestHost
public static AttributeMapper<NestHostAttribute> nestHost()
Returns the mapper for the
NestHost attribute.- Returns:
- the mapper for the
NestHostattribute
nestMembers
public static AttributeMapper<NestMembersAttribute> nestMembers()
Returns the mapper for the
NestMembers attribute.- Returns:
- the mapper for the
NestMembersattribute
permittedSubclasses
public static AttributeMapper<PermittedSubclassesAttribute> permittedSubclasses()
Returns the mapper for the
PermittedSubclasses attribute.- Returns:
- the mapper for the
PermittedSubclassesattribute
record
public static AttributeMapper<RecordAttribute> record()
Returns the mapper for the
Record attribute.- Returns:
- the mapper for the
Recordattribute
runtimeInvisibleAnnotations
public static AttributeMapper<RuntimeInvisibleAnnotationsAttribute> runtimeInvisibleAnnotations()
Returns the mapper for the
RuntimeInvisibleAnnotations attribute.- Returns:
- the mapper for the
RuntimeInvisibleAnnotationsattribute
runtimeInvisibleParameterAnnotations
public static AttributeMapper<RuntimeInvisibleParameterAnnotationsAttribute> runtimeInvisibleParameterAnnotations()
Returns the mapper for the
RuntimeInvisibleParameterAnnotations attribute.- Returns:
- the mapper for the
RuntimeInvisibleParameterAnnotationsattribute
runtimeInvisibleTypeAnnotations
public static AttributeMapper<RuntimeInvisibleTypeAnnotationsAttribute> runtimeInvisibleTypeAnnotations()
Returns the mapper for the
RuntimeInvisibleTypeAnnotations attribute. This has a data dependency on arbitrary indices in the class file format.- Returns:
- the mapper for the
RuntimeInvisibleTypeAnnotationsattribute
runtimeVisibleAnnotations
public static AttributeMapper<RuntimeVisibleAnnotationsAttribute> runtimeVisibleAnnotations()
Returns the mapper for the
RuntimeVisibleAnnotations attribute.- Returns:
- the mapper for the
RuntimeVisibleAnnotationsattribute
runtimeVisibleParameterAnnotations
public static AttributeMapper<RuntimeVisibleParameterAnnotationsAttribute> runtimeVisibleParameterAnnotations()
Returns the mapper for the
RuntimeVisibleParameterAnnotations attribute.- Returns:
- the mapper for the
RuntimeVisibleParameterAnnotationsattribute
runtimeVisibleTypeAnnotations
public static AttributeMapper<RuntimeVisibleTypeAnnotationsAttribute> runtimeVisibleTypeAnnotations()
Returns the mapper for the
RuntimeVisibleTypeAnnotations attribute. This has a data dependency on arbitrary indices in the class file format.- Returns:
- the mapper for the
RuntimeVisibleTypeAnnotationsattribute
signature
public static AttributeMapper<SignatureAttribute> signature()
Returns the mapper for the
Signature attribute.- Returns:
- the mapper for the
Signatureattribute
sourceDebugExtension
public static AttributeMapper<SourceDebugExtensionAttribute> sourceDebugExtension()
Returns the mapper for the
SourceDebugExtension attribute. This has no data dependency.- Returns:
- the mapper for the
SourceDebugExtensionattribute
sourceFile
public static AttributeMapper<SourceFileAttribute> sourceFile()
Returns the mapper for the
SourceFile attribute.- Returns:
- the mapper for the
SourceFileattribute
sourceId
public static AttributeMapper<SourceIDAttribute> sourceId()
Returns the mapper for the
SourceID attribute. This is a JDK-specific attribute.- Returns:
- the mapper for the
SourceIDattribute
stackMapTable
public static AttributeMapper<StackMapTableAttribute> stackMapTable()
Returns the mapper for the
StackMapTable attribute. This has a data dependency on labels.- Returns:
- the mapper for the
StackMapTableattribute
synthetic
public static AttributeMapper<SyntheticAttribute> synthetic()
Returns the mapper for the
Synthetic attribute. The mapper permits multiple instances in a given location. This has no data dependency.- Returns:
- the mapper for the
Syntheticattribute
© 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/Attributes.html