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 Details

    • 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 (see Opcodes). This field also indicates if the class is deprecated Opcodes.ACC_DEPRECATED or a record Opcodes.ACC_RECORD.
    • name

      public String name
      The internal name of this class (see Type.getInternalName()).
    • signature

      public String signature
      The signature of this class. May be null.
    • superName

      public String superName
      The internal of name of the super class (see Type.getInternalName()). For interfaces, the super class is Object. May be null, but only for the Object class.
    • interfaces

      public List<String> interfaces
      The internal names of the interfaces directly implemented by this class (see Type.getInternalName()).
    • sourceFile

      public String sourceFile
      The name of the source file from which this class was compiled. May be null.
    • sourceDebug

      public 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 String outerClass
      The internal name of the enclosing class of this class (see Type.getInternalName()). Must be null if this class has no enclosing class, or if it is a local or anonymous class.
    • outerMethod

      public String outerMethod
      The name of the method that contains the class, or null if the class has no enclosing class, or is not enclosed in a method or constructor of its enclosing class (e.g. if it is enclosed in an instance initializer, static initializer, instance variable initializer, or class variable initializer).
    • outerMethodDesc

      public String outerMethodDesc
      The descriptor of the method that contains the class, or null if the class has no enclosing class, or is not enclosed in a method or constructor of its enclosing class (e.g. if it is enclosed in an instance initializer, static initializer, instance variable initializer, or class variable initializer).
    • visibleAnnotations

      public List<AnnotationNode> visibleAnnotations
      The runtime visible annotations of this class. May be null.
    • invisibleAnnotations

      public List<AnnotationNode> invisibleAnnotations
      The runtime invisible annotations of this class. May be null.
    • visibleTypeAnnotations

      public List<TypeAnnotationNode> visibleTypeAnnotations
      The runtime visible type annotations of this class. May be null.
    • invisibleTypeAnnotations

      public List<TypeAnnotationNode> invisibleTypeAnnotations
      The runtime invisible type annotations of this class. May be null.
    • attrs

      public List<org.objectweb.asm.Attribute> attrs
      The non standard attributes of this class. May be null.
    • innerClasses

      public List<InnerClassNode> innerClasses
      The inner classes of this class.
    • nestHostClass

      public String nestHostClass
      The internal name of the nest host class of this class (see Type.getInternalName()). May be null.
    • nestMembers

      public List<String> nestMembers
      The internal names of the nest members of this class (see Type.getInternalName()). May be null.
    • permittedSubclasses

      public List<String> permittedSubclasses
      The internal names of the permitted subclasses of this class (see Type.getInternalName()). May be null.
    • recordComponents

      public List<RecordComponentNode> recordComponents
      The record components of this class. May be null.
    • fields

      public List<FieldNode> fields
      The fields of this class.
    • methods

      public List<MethodNode> methods
      The methods of this class.
  • Constructor Details

    • ClassNode

      public ClassNode()
      Constructs a new ClassNode. Subclasses must not use this constructor. Instead, they must use the ClassNode(int) version.
      Throws:
      IllegalStateException - If a subclass calls this constructor.
    • ClassNode

      public ClassNode(int api)
      Constructs a new ClassNode.
      Parameters:
      api - the ASM API version implemented by this visitor. Must be one of the ASMx values in Opcodes.
  • Method Details

    • visit

      public void visit(int version, int access, String name, String signature, String superName, String[] interfaces)
      Overrides:
      visit in class org.objectweb.asm.ClassVisitor
    • visitSource

      public void visitSource(String file, String debug)
      Overrides:
      visitSource in class org.objectweb.asm.ClassVisitor
    • visitModule

      public org.objectweb.asm.ModuleVisitor visitModule(String name, int access, String version)
      Overrides:
      visitModule in class org.objectweb.asm.ClassVisitor
    • visitNestHost

      public void visitNestHost(String nestHost)
      Overrides:
      visitNestHost in class org.objectweb.asm.ClassVisitor
    • visitOuterClass

      public void visitOuterClass(String owner, String name, String descriptor)
      Overrides:
      visitOuterClass in class org.objectweb.asm.ClassVisitor
    • visitAnnotation

      public org.objectweb.asm.AnnotationVisitor visitAnnotation(String descriptor, boolean visible)
      Overrides:
      visitAnnotation in class org.objectweb.asm.ClassVisitor
    • visitTypeAnnotation

      public org.objectweb.asm.AnnotationVisitor visitTypeAnnotation(int typeRef, org.objectweb.asm.TypePath typePath, String descriptor, boolean visible)
      Overrides:
      visitTypeAnnotation in class org.objectweb.asm.ClassVisitor
    • visitAttribute

      public void visitAttribute(org.objectweb.asm.Attribute attribute)
      Overrides:
      visitAttribute in class org.objectweb.asm.ClassVisitor
    • visitNestMember

      public void visitNestMember(String nestMember)
      Overrides:
      visitNestMember in class org.objectweb.asm.ClassVisitor
    • visitPermittedSubclass

      public void visitPermittedSubclass(String permittedSubclass)
      Overrides:
      visitPermittedSubclass in class org.objectweb.asm.ClassVisitor
    • visitInnerClass

      public void visitInnerClass(String name, String outerName, String innerName, int access)
      Overrides:
      visitInnerClass in class org.objectweb.asm.ClassVisitor
    • visitRecordComponent

      public org.objectweb.asm.RecordComponentVisitor visitRecordComponent(String name, String descriptor, String signature)
      Overrides:
      visitRecordComponent in class org.objectweb.asm.ClassVisitor
    • visitField

      public org.objectweb.asm.FieldVisitor visitField(int access, String name, String descriptor, String signature, Object value)
      Overrides:
      visitField in class org.objectweb.asm.ClassVisitor
    • visitMethod

      public org.objectweb.asm.MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions)
      Overrides:
      visitMethod in class org.objectweb.asm.ClassVisitor
    • visitEnd

      public void visitEnd()
      Overrides:
      visitEnd in class org.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 of the ASMx values in Opcodes.
    • accept

      public void accept(org.objectweb.asm.ClassVisitor classVisitor)
      Makes the given class visitor visit this class.
      Parameters:
      classVisitor - a class visitor.