Attribute<SignatureAttribute>, ClassElement, ClassFileElement, FieldElement, MethodElementpublic sealed interface SignatureAttribute extends Attribute<SignatureAttribute>, ClassElement, MethodElement, FieldElement
Signature attribute (JVMS 4.7.9), which indicates the generic signature of this structure. This attribute appears on classes, fields, methods, and record components, and does not permit multiple instances in one structure. It has a data dependency on the constant pool.
The attribute was introduced in the Java SE Platform version 5.0, major version 49.
Signature Attribute| Modifier and Type | Method | Description |
|---|---|---|
default ClassSignature |
asClassSignature() |
Parses the signature string as a class signature. |
default MethodSignature |
asMethodSignature() |
Parse the signature string as a method signature. |
default Signature |
asTypeSignature() |
Parses the signature string as a Java type signature. |
static SignatureAttribute |
of |
Returns a Signature attribute for a class. |
static SignatureAttribute |
of |
Returns a Signature attribute. |
static SignatureAttribute |
of |
Returns a Signature attribute for a method. |
static SignatureAttribute |
of |
Returns a Signature attribute for a field or a record component. |
Utf8Entry |
signature() |
Returns the signature string for the class, method, field, or record component. |
attributeMapper, attributeName
Utf8Entry signature()
default ClassSignature asClassSignature()
IllegalArgumentException - if the signature string is not a valid class signature stringdefault MethodSignature asMethodSignature()
IllegalArgumentException - if the signature string is not a valid method signature stringdefault Signature asTypeSignature()
IllegalArgumentException - if the signature string is not a valid Java type signature stringstatic SignatureAttribute of(ClassSignature classSignature)
Signature attribute for a class.classSignature - the class signatureSignature attribute for a classstatic SignatureAttribute of(MethodSignature methodSignature)
Signature attribute for a method.methodSignature - the method signatureSignature attribute for a methodstatic SignatureAttribute of(Signature signature)
Signature attribute for a field or a record component.signature - the Java type signatureSignature attribute for a field or a record componentstatic SignatureAttribute of(Utf8Entry signature)
Signature attribute.signature - the signature stringSignature attribute
© 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/attribute/SignatureAttribute.html