Package org.objectweb.asm.tree
Class ClassNode
- java.lang.Object
-
- org.objectweb.asm.ClassVisitor
-
- org.objectweb.asm.tree.ClassNode
-
public class ClassNode extends org.objectweb.asm.ClassVisitor
A node that represents a class.
-
-
Field Summary
Fields Modifier and Type Field Description int
access
The class's access flags (seeOpcodes
).java.util.List<org.objectweb.asm.Attribute>
attrs
The non standard attributes of this class.java.util.List<FieldNode>
fields
The fields of this class.java.util.List<InnerClassNode>
innerClasses
The inner classes of this class.java.util.List<java.lang.String>
interfaces
The internal names of the interfaces directly implemented by this class (seeType.getInternalName()
).java.util.List<AnnotationNode>
invisibleAnnotations
The runtime invisible annotations of this class.java.util.List<TypeAnnotationNode>
invisibleTypeAnnotations
The runtime invisible type annotations of this class.java.util.List<MethodNode>
methods
The methods of this class.ModuleNode
module
The module stored in this class.java.lang.String
name
The internal name of this class (seeType.getInternalName()
).java.lang.String
nestHostClass
The internal name of the nest host class of this class.java.util.List<java.lang.String>
nestMembers
The internal names of the nest members of this class.java.lang.String
outerClass
The internal name of the enclosing class of this class.java.lang.String
outerMethod
The name of the method that contains this class, or null if this class is not enclosed in a method.java.lang.String
outerMethodDesc
The descriptor of the method that contains this class, or null if this class is not enclosed in a method.java.util.List<java.lang.String>
permittedSubclasses
The internal names of the permitted subclasses of this class.java.util.List<RecordComponentNode>
recordComponents
The record components of this class.java.lang.String
signature
The signature of this class.java.lang.String
sourceDebug
The correspondence between source and compiled elements of this class.java.lang.String
sourceFile
The name of the source file from which this class was compiled.java.lang.String
superName
The internal of name of the super class (seeType.getInternalName()
).int
version
The class version.java.util.List<AnnotationNode>
visibleAnnotations
The runtime visible annotations of this class.java.util.List<TypeAnnotationNode>
visibleTypeAnnotations
The runtime visible type annotations of this class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(org.objectweb.asm.ClassVisitor classVisitor)
Makes the given class visitor visit this class.void
check(int api)
Checks that this class node is compatible with the given ASM API version.void
visit(int version, int access, java.lang.String name, java.lang.String signature, java.lang.String superName, java.lang.String[] interfaces)
org.objectweb.asm.AnnotationVisitor
visitAnnotation(java.lang.String descriptor, boolean visible)
void
visitAttribute(org.objectweb.asm.Attribute attribute)
void
visitEnd()
org.objectweb.asm.FieldVisitor
visitField(int access, java.lang.String name, java.lang.String descriptor, java.lang.String signature, java.lang.Object value)
void
visitInnerClass(java.lang.String name, java.lang.String outerName, java.lang.String innerName, int access)
org.objectweb.asm.MethodVisitor
visitMethod(int access, java.lang.String name, java.lang.String descriptor, java.lang.String signature, java.lang.String[] exceptions)
org.objectweb.asm.ModuleVisitor
visitModule(java.lang.String name, int access, java.lang.String version)
void
visitNestHost(java.lang.String nestHost)
void
visitNestMember(java.lang.String nestMember)
void
visitOuterClass(java.lang.String owner, java.lang.String name, java.lang.String descriptor)
void
visitPermittedSubclass(java.lang.String permittedSubclass)
org.objectweb.asm.RecordComponentVisitor
visitRecordComponent(java.lang.String name, java.lang.String descriptor, java.lang.String signature)
void
visitSource(java.lang.String file, java.lang.String debug)
org.objectweb.asm.AnnotationVisitor
visitTypeAnnotation(int typeRef, org.objectweb.asm.TypePath typePath, java.lang.String descriptor, boolean visible)
-
-
-
Field Detail
-
version
public int version
The class version. The minor version is stored in the 16 most significant bits, and the major version in the 16 least significant bits.
-
access
public int access
The class's access flags (seeOpcodes
). This field also indicates if the class is deprecatedOpcodes.ACC_DEPRECATED
or a recordOpcodes.ACC_RECORD
.
-
name
public java.lang.String name
The internal name of this class (seeType.getInternalName()
).
-
signature
public java.lang.String signature
The signature of this class. May be null.
-
superName
public java.lang.String superName
The internal of name of the super class (seeType.getInternalName()
). For interfaces, the super class isObject
. May be null, but only for theObject
class.
-
interfaces
public java.util.List<java.lang.String> interfaces
The internal names of the interfaces directly implemented by this class (seeType.getInternalName()
).
-
sourceFile
public java.lang.String sourceFile
The name of the source file from which this class was compiled. May be null.
-
sourceDebug
public java.lang.String sourceDebug
The correspondence between source and compiled elements of this class. May be null.
-
module
public ModuleNode module
The module stored in this class. May be null.
-
outerClass
public java.lang.String outerClass
The internal name of the enclosing class of this class. May be null.
-
outerMethod
public java.lang.String outerMethod
The name of the method that contains this class, or null if this class is not enclosed in a method.
-
outerMethodDesc
public java.lang.String outerMethodDesc
The descriptor of the method that contains this class, or null if this class is not enclosed in a method.
-
visibleAnnotations
public java.util.List<AnnotationNode> visibleAnnotations
The runtime visible annotations of this class. May be null.
-
invisibleAnnotations
public java.util.List<AnnotationNode> invisibleAnnotations
The runtime invisible annotations of this class. May be null.
-
visibleTypeAnnotations
public java.util.List<TypeAnnotationNode> visibleTypeAnnotations
The runtime visible type annotations of this class. May be null.
-
invisibleTypeAnnotations
public java.util.List<TypeAnnotationNode> invisibleTypeAnnotations
The runtime invisible type annotations of this class. May be null.
-
attrs
public java.util.List<org.objectweb.asm.Attribute> attrs
The non standard attributes of this class. May be null.
-
innerClasses
public java.util.List<InnerClassNode> innerClasses
The inner classes of this class.
-
nestHostClass
public java.lang.String nestHostClass
The internal name of the nest host class of this class. May be null.
-
nestMembers
public java.util.List<java.lang.String> nestMembers
The internal names of the nest members of this class. May be null.
-
permittedSubclasses
public java.util.List<java.lang.String> permittedSubclasses
The internal names of the permitted subclasses of this class. May be null.
-
recordComponents
public java.util.List<RecordComponentNode> recordComponents
The record components of this class. May be null.
-
fields
public java.util.List<FieldNode> fields
The fields of this class.
-
methods
public java.util.List<MethodNode> methods
The methods of this class.
-
-
Constructor Detail
-
ClassNode
public ClassNode()
Constructs a newClassNode
. Subclasses must not use this constructor. Instead, they must use theClassNode(int)
version.- Throws:
java.lang.IllegalStateException
- If a subclass calls this constructor.
-
ClassNode
public ClassNode(int api)
Constructs a newClassNode
.- Parameters:
api
- the ASM API version implemented by this visitor. Must be one ofOpcodes.ASM4
,Opcodes.ASM5
,Opcodes.ASM6
,Opcodes.ASM7
,Opcodes.ASM8
, orOpcodes.ASM9
.
-
-
Method Detail
-
visit
public void visit(int version, int access, java.lang.String name, java.lang.String signature, java.lang.String superName, java.lang.String[] interfaces)
- Overrides:
visit
in classorg.objectweb.asm.ClassVisitor
-
visitSource
public void visitSource(java.lang.String file, java.lang.String debug)
- Overrides:
visitSource
in classorg.objectweb.asm.ClassVisitor
-
visitModule
public org.objectweb.asm.ModuleVisitor visitModule(java.lang.String name, int access, java.lang.String version)
- Overrides:
visitModule
in classorg.objectweb.asm.ClassVisitor
-
visitNestHost
public void visitNestHost(java.lang.String nestHost)
- Overrides:
visitNestHost
in classorg.objectweb.asm.ClassVisitor
-
visitOuterClass
public void visitOuterClass(java.lang.String owner, java.lang.String name, java.lang.String descriptor)
- Overrides:
visitOuterClass
in classorg.objectweb.asm.ClassVisitor
-
visitAnnotation
public org.objectweb.asm.AnnotationVisitor visitAnnotation(java.lang.String descriptor, boolean visible)
- Overrides:
visitAnnotation
in classorg.objectweb.asm.ClassVisitor
-
visitTypeAnnotation
public org.objectweb.asm.AnnotationVisitor visitTypeAnnotation(int typeRef, org.objectweb.asm.TypePath typePath, java.lang.String descriptor, boolean visible)
- Overrides:
visitTypeAnnotation
in classorg.objectweb.asm.ClassVisitor
-
visitAttribute
public void visitAttribute(org.objectweb.asm.Attribute attribute)
- Overrides:
visitAttribute
in classorg.objectweb.asm.ClassVisitor
-
visitNestMember
public void visitNestMember(java.lang.String nestMember)
- Overrides:
visitNestMember
in classorg.objectweb.asm.ClassVisitor
-
visitPermittedSubclass
public void visitPermittedSubclass(java.lang.String permittedSubclass)
- Overrides:
visitPermittedSubclass
in classorg.objectweb.asm.ClassVisitor
-
visitInnerClass
public void visitInnerClass(java.lang.String name, java.lang.String outerName, java.lang.String innerName, int access)
- Overrides:
visitInnerClass
in classorg.objectweb.asm.ClassVisitor
-
visitRecordComponent
public org.objectweb.asm.RecordComponentVisitor visitRecordComponent(java.lang.String name, java.lang.String descriptor, java.lang.String signature)
- Overrides:
visitRecordComponent
in classorg.objectweb.asm.ClassVisitor
-
visitField
public org.objectweb.asm.FieldVisitor visitField(int access, java.lang.String name, java.lang.String descriptor, java.lang.String signature, java.lang.Object value)
- Overrides:
visitField
in classorg.objectweb.asm.ClassVisitor
-
visitMethod
public org.objectweb.asm.MethodVisitor visitMethod(int access, java.lang.String name, java.lang.String descriptor, java.lang.String signature, java.lang.String[] exceptions)
- Overrides:
visitMethod
in classorg.objectweb.asm.ClassVisitor
-
visitEnd
public void visitEnd()
- Overrides:
visitEnd
in classorg.objectweb.asm.ClassVisitor
-
check
public void check(int api)
Checks that this class node is compatible with the given ASM API version. This method checks that this node, and all its children recursively, do not contain elements that were introduced in more recent versions of the ASM API than the given version.- Parameters:
api
- an ASM API version. Must be one ofOpcodes.ASM4
,Opcodes.ASM5
,Opcodes.ASM6
,Opcodes.ASM7
,Opcodes.ASM8
orOpcodes.ASM9
.
-
accept
public void accept(org.objectweb.asm.ClassVisitor classVisitor)
Makes the given class visitor visit this class.- Parameters:
classVisitor
- a class visitor.
-
-