Package: org.codehaus.groovy.ast

## [Java] Class ClassNode

- org.codehaus.groovy.ast.ClassNode

-     public class ClassNode
      extends AnnotatedNode

  Represents a class in the AST.

  A ClassNode should be created using the methods in ClassHelper. This ClassNode may be used to represent a class declaration or any other type. This class uses a proxy mechanism allowing to create a class for a plain name at AST creation time. In another phase of the compiler the real ClassNode for the plain name may be found. To avoid the need of exchanging this ClassNode with an instance of the correct ClassNode the correct ClassNode is set as redirect. Most method calls are then redirected to that ClassNode.

  There are three types of ClassNodes:

  1. Primary ClassNodes:
     A primary ClassNode is one where we have a source representation which is to be compiled by Groovy and which we have an AST for. The groovy compiler will output one class for each such ClassNode that passes through AsmBytecodeGenerator... not more, not less. That means for example Closures become such ClassNodes too at some point.
  2. ClassNodes create through different sources (typically created from a java.lang.reflect.Class object):
     The compiler will not output classes from these, the methods usually do not contain bodies. These kind of ClassNodes will be used in different checks, but not checks that work on the method bodies. For example if such a ClassNode is a super class to a primary ClassNode, then the abstract method test and others will be done with data based on these. Theoretically it is also possible to mix both (1 and 2) kind of classes in a hierarchy, but this probably works only in the newest Groovy versions. Such ClassNodes normally have to isResolved() returning true without having a redirect.In the Groovy compiler the only version of this, that exists, is a ClassNode created through a Class instance
  3. Labels:
     ClassNodes created through ClassHelper.makeWithoutCaching. They are placeholders, its redirect points to the real structure, which can be a label too, but following all redirects it should end with a ClassNode from one of the other two categories. If ResolveVisitor finds such a node, it tries to set the redirects. Any such label created after ResolveVisitor has done its work needs to have a redirect pointing to case 1 or 2. If not the compiler may react strange... this can be considered as a kind of dangling pointer.
  Note: the redirect mechanism is only allowed for classes that are not primary ClassNodes. Typically this is done for classes created by name only. The redirect itself can be any type of ClassNode.

  To describe generic type signature see getGenericsTypes() and setGenericsTypes(GenericsType[]). These methods are not proxied, they describe the type signature used at the point of declaration or the type signatures provided by the class. If the type signatures provided by the class are needed, then a call to redirect() will help. getOuterClassType() / setOuterClassType(ClassNode) are likewise not proxied: they record the parameterized enclosing type of a JLS 4.5 rare type use (`Outer<T>.Inner`), distinct from getOuterClass() which is the enclosing class of a nested class declaration.

  See Also:
    ClassHelper

- - ### Field Summary

    Fields
    Modifiers | Name | Description
    --- | --- | ---
    `static ClassNode[]` | `EMPTY_ARRAY` |
    `static ClassNode` | `SUPER` |
    `static ClassNode` | `THIS` |
    `protected Class<?>` | `clazz` |
    `protected boolean` | `isPrimaryNode` |
    `protected Object` | `lazyInitLock` |

  - ### Constructor Summary

    Constructors
    Constructor and description
    `ClassNode(String name, int modifiers, ClassNode superClass, ClassNode[] interfaces, MixinNode[] mixins)` Constructs a primary `ClassNode` representing a class declaration with all components.
    `ClassNode(String name, int modifiers, ClassNode superClass)` Constructs a primary `ClassNode` representing a class declaration with superclass.
    `ClassNode(Class<?> c)` Constructs a non-primary `ClassNode` from a real Java class.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public void` | `addConstructor(ConstructorNode node)`
    `` | `public ConstructorNode` | `addConstructor(int modifiers, Parameter[] parameters, ClassNode[] exceptions, Statement code)`
    `` | `public void` | `addField(FieldNode node)` Adds a FieldNode to this ClassNode.
    `` | `public FieldNode` | `addField(String name, int modifiers, ClassNode type, Expression initialValue)` Creates and adds a FieldNode to this ClassNode with the specified properties.
    `` | `public void` | `addFieldFirst(FieldNode node)` Adds a FieldNode to this ClassNode at the beginning of the field list.
    `` | `public FieldNode` | `addFieldFirst(String name, int modifiers, ClassNode type, Expression initialValue)` Creates and adds a FieldNode to the beginning of this ClassNode's field list with the specified properties.
    `` | `public void` | `addInterface(ClassNode node)` Adds an interface to the list of interfaces implemented by this ClassNode.
    `` | `public void` | `addMethod(MethodNode node)` Adds a MethodNode to this ClassNode.
    `` | `public MethodNode` | `addMethod(String name, int modifiers, ClassNode returnType, Parameter[] parameters, ClassNode[] exceptions, Statement code)` Creates and adds a MethodNode to this ClassNode with the specified properties, but only if a method with the same name and parameter signature does not already exist.
    `` | `public void` | `addMixin(MixinNode node)`
    `` | `public void` | `addObjectInitializerStatements(Statement statement)` Adds a statement to the object initializer.
    `` | `public void` | `addProperty(PropertyNode node)` Adds a PropertyNode to this ClassNode.
    `` | `public PropertyNode` | `addProperty(String name, int modifiers, ClassNode type, Expression initialValue, Statement getterBlock, Statement setterBlock)` Creates and adds a PropertyNode to this ClassNode with the specified properties, or returns an existing property with the same name if one is already present.
    `` | `public void` | `addStaticInitializerStatements(List<Statement> statements, boolean fieldInit)`
    `` | `public MethodNode` | `addSyntheticMethod(String name, int modifiers, ClassNode returnType, Parameter[] parameters, ClassNode[] exceptions, Statement code)` Adds a synthetic method as part of the compilation process.
    `` | `public void` | `addTransform(Class<? extends ASTTransformation> transform, ASTNode node)`
    `` | `public void` | `addTypeAnnotation(AnnotationNode annotation)`
    `` | `public void` | `addTypeAnnotations(List<AnnotationNode> annotations)`
    `` | `public GenericsType` | `asGenericsType()`
    `` | `public boolean` | `declaresAnyInterfaces(ClassNode classNodes)` Parameters: `classNodes` - the class nodes for the interfaces
    `` | `public boolean` | `declaresInterface(ClassNode classNode)` Parameters: `classNode` - the class node for the interface
    `` | `public boolean` | `equals(Object that)` Compares this ClassNode with another object for equality.
    `` | `public List<MethodNode>` | `getAbstractMethods()` Returns a list of all abstract MethodNodes declared in this ClassNode.
    `` | `public List<MethodNode>` | `getAllDeclaredMethods()` Returns all declared MethodNodes from this ClassNode and its superclasses and interfaces as a list.
    `` | `public Set<ClassNode>` | `getAllInterfaces()`
    `` | `public List<AnnotationNode>` | `getAnnotations()`
    `` | `public List<AnnotationNode>` | `getAnnotations(ClassNode type)`
    `` | `public CompileUnit` | `getCompileUnit()`
    `` | `public ClassNode` | `getComponentType()` Returns the component type of this array ClassNode.
    `` | `public ConstructorNode` | `getDeclaredConstructor(Parameter[] parameters)` Returns: the constructor matching the given parameters or `null`
    `` | `public List<ConstructorNode>` | `getDeclaredConstructors()`
    `` | `public FieldNode` | `getDeclaredField(String name)` Finds a FieldNode matching the given name declared directly in this class.
    `` | `public MethodNode` | `getDeclaredMethod(String name, Parameter[] parameters)` Finds a MethodNode matching the given name and parameter signature declared directly in this class.
    `` | `public List<MethodNode>` | `getDeclaredMethods(String name)` Returns a list of all MethodNodes with the given name declared directly in this class.
    `` | `public Map<String, MethodNode>` | `getDeclaredMethodsMap()` Returns all declared MethodNodes from this ClassNode and its superclasses and interfaces.
    `` | `public MethodNode` | `getEnclosingMethod()` Returns the enclosing MethodNode of this local inner class, or `null` if this is not a local inner class.
    `` | `public FieldNode` | `getField(String name)` Finds a FieldNode matching the given name in this class or any of its superclasses.
    `` | `public Map<String, FieldNode>` | `getFieldIndex()` Returns the internal field index map for fast field lookup by name.
    `` | `public List<FieldNode>` | `getFields()` Returns all FieldNodes declared in this ClassNode, including inherited fields.
    `` | `public GenericsType[]` | `getGenericsTypes()` Returns the generic type parameters for this ClassNode, or `null` if none are defined.
    `` | `public MethodNode` | `getGetterMethod(String getterName)` Finds a getter MethodNode matching the given name, optionally searching superclasses.
    `` | `public MethodNode` | `getGetterMethod(String getterName, boolean searchSupers)` Finds a getter MethodNode matching the given name, optionally searching superclasses and interfaces.
    `` | `public Iterator<InnerClassNode>` | `getInnerClasses()` Returns an iterator over the inner classes defined within this ClassNode.
    `` | `public ClassNode[]` | `getInterfaces()` Returns: the interfaces implemented by this `ClassNode`
    `` | `public MethodNode` | `getMethod(String name, Parameter[] parameters)` Finds a MethodNode matching the given name and parameter signature in this class or any of its superclasses.
    `` | `public List<MethodNode>` | `getMethods()` Returns all MethodNodes declared in this ClassNode, including inherited and synthetic methods.
    `` | `public List<MethodNode>` | `getMethods(String name)` Returns a list of all MethodNodes with the given name from this class and its superclasses.
    `` | `public MixinNode[]` | `getMixins()` Returns: the mixins associated with this `ClassNode`
    `` | `public int` | `getModifiers()` Returns the modifier flags for this ClassNode, combining visibility and behavioral modifiers.
    `` | `public ModuleNode` | `getModule()`
    `` | `public String` | `getName()` Returns the fully-qualified name of this class after following any redirects.
    `` | `public String` | `getNameWithoutPackage()`
    `` | `public List<Statement>` | `getObjectInitializerStatements()`
    `` | `public ClassNode` | `getOuterClass()` Returns the outer class of this ClassNode, or `null` if this is not an inner class.
    `` | `public ClassNode` | `getOuterClassType()` For a JLS 4.5 rare type `Outer<T>.Inner`, the parameterized enclosing type stored on this node (type-use, not declaration; not node metadata and not redirected).
    `` | `public List<ClassNode>` | `getOuterClasses()` Returns a list of all outer classes enclosing this ClassNode in hierarchical order.
    `` | `public FieldNode` | `getOuterField(String name)` Returns: the field on the outer class or `null` if this is not an inner class
    `` | `public PackageNode` | `getPackage()`
    `` | `public String` | `getPackageName()`
    `` | `public List<ClassNode>` | `getPermittedSubclasses()` Returns: permitted subclasses of sealed type, may initially be empty in early compiler phases
    `` | `public ClassNode` | `getPlainNodeReference()`
    `` | `public ClassNode` | `getPlainNodeReference(boolean skipPrimitives)`
    `` | `public List<PropertyNode>` | `getProperties()` Returns all PropertyNodes declared in this ClassNode.
    `` | `public PropertyNode` | `getProperty(String name)` Finds a PropertyNode matching the given name in this ClassNode.
    `` | `public List<RecordComponentNode>` | `getRecordComponents()` Gets the record components of record type.
    `` | `public MethodNode` | `getSetterMethod(String setterName)` Finds a setter MethodNode matching the given name, optionally searching superclasses.
    `` | `public MethodNode` | `getSetterMethod(String setterName, boolean voidOnly)` Finds a setter MethodNode matching the given name.
    `` | `public ClassNode` | `getSuperClass()` Returns: the `ClassNode` of the super class of this type
    `` | `public String` | `getText()`
    `` | `public Map<Class<? extends ASTTransformation>, Set<ASTNode>>` | `getTransforms(CompilePhase phase)`
    `` | `public List<AnnotationNode>` | `getTypeAnnotations()`
    `` | `public List<AnnotationNode>` | `getTypeAnnotations(ClassNode type)`
    `` | `public Class` | `getTypeClass()` Returns the concrete class this classnode relates to.
    `` | `public ClassNode[]` | `getUnresolvedInterfaces()` Returns the unresolved interfaces implemented by this ClassNode, using redirect resolution by default.
    `` | `public ClassNode[]` | `getUnresolvedInterfaces(boolean deref)` Returns the unresolved interfaces implemented by this ClassNode with optional redirect resolution.
    `` | `public String` | `getUnresolvedName()`
    `` | `public ClassNode` | `getUnresolvedSuperClass()` Returns the unresolved super class of this ClassNode, using redirect resolution by default.
    `` | `public ClassNode` | `getUnresolvedSuperClass(boolean deref)` Returns the unresolved super class of this ClassNode with optional redirect resolution.
    `` | `public boolean` | `hasDeclaredMethod(String name, Parameter[] parameters)` Tests whether a method with the given name and parameter signature is declared directly in this class (not inherited from a superclass).
    `` | `public boolean` | `hasMethod(String name, Parameter[] parameters)` Tests whether a method with the given name and parameter signature exists in this class or any of its superclasses.
    `` | `public boolean` | `hasPackageName()`
    `` | `public boolean` | `hasPossibleMethod(String name, Expression arguments)` Determines if the type has a possibly-matching instance method with the given name and arguments.
    `` | `public boolean` | `hasPossibleStaticMethod(String name, Expression arguments)` Checks if the given method has a possibly matching static method with the given name and arguments.
    `` | `public boolean` | `hasProperty(String name)` Tests whether a property with the given name exists in this ClassNode.
    `` | `public int` | `hashCode()` Returns the hash code for this ClassNode.
    `` | `public boolean` | `implementsAnyInterfaces(ClassNode classNodes)` Parameters: `classNodes` - the class nodes for the interfaces
    `` | `public boolean` | `implementsInterface(ClassNode classNode)` Parameters: `classNode` - the class node for the interface
    `` | `public boolean` | `isAbstract()` Returns whether this ClassNode represents an abstract class.
    `` | `public boolean` | `isAnnotated()` Returns whether this ClassNode has been marked as annotated.
    `` | `public boolean` | `isAnnotationDefinition()` Returns whether this ClassNode represents an annotation type (annotation definition).
    `` | `public boolean` | `isArray()` Determines whether this ClassNode represents an array type.
    `` | `public boolean` | `isDerivedFrom(ClassNode type)` Parameters: `type` - the ClassNode of interest
    `` | `public boolean` | `isDerivedFromGroovyObject()` Returns whether this ClassNode represents a type that implements the `GroovyObject` interface.
    `` | `public boolean` | `isEnum()` Returns whether this ClassNode represents an enumeration type.
    `` | `public boolean` | `isGenericsPlaceHolder()`
    `` | `public boolean` | `isInterface()` Returns whether this ClassNode represents an interface type.
    `` | `public boolean` | `isPrimaryClassNode()` Determines whether this ClassNode is a primary node or redirects to one.
    `` | `public boolean` | `isRecord()` Checks if the ClassNode instance represents a native `record`.
    `` | `public boolean` | `isRedirectNode()` Returns whether this ClassNode is a redirect (proxy) node for another ClassNode.
    `` | `public boolean` | `isResolved()` Determines whether this ClassNode has been resolved to an actual Java class.
    `` | `public boolean` | `isScript()` Returns whether this ClassNode represents a Groovy script body.
    `` | `public boolean` | `isScriptBody()` Returns whether this inner class or closure was declared inside a script body.
    `` | `public boolean` | `isSealed()` Returns: `true` for native and emulated (annotation based) sealed classes
    `` | `public boolean` | `isStatic()` Returns whether this ClassNode represents a static class.
    `` | `public boolean` | `isStaticClass()` Returns whether this inner class or closure was declared inside a static method context.
    `` | `public boolean` | `isSyntheticPublic()` Indicates that this class has been "promoted" to public by Groovy when in fact there was no public modifier explicitly in the source code.
    `` | `public boolean` | `isUsingGenerics()`
    `` | `public ClassNode` | `makeArray()` Returns a `ClassNode` representing an array of the type represented by this.
    `` | `protected boolean` | `parametersEqual(Parameter[] a, Parameter[] b)`
    `` | `public void` | `positionStmtsAfterEnumInitStmts(List<Statement> staticFieldInitializerStatements)`
    `` | `public ClassNode` | `redirect()` Returns the `ClassNode` this node is a proxy for or the node itself.
    `` | `public void` | `removeConstructor(ConstructorNode node)`
    `` | `public void` | `removeField(String oldName)` Removes the FieldNode with the given name from this ClassNode.
    `` | `public void` | `removeMethod(MethodNode node)` Removes the given MethodNode from this ClassNode.
    `` | `public void` | `renameField(String oldName, String newName)`
    `` | `public void` | `setAnnotated(boolean annotated)` Marks this ClassNode as having annotations attached to it.
    `` | `protected void` | `setCompileUnit(CompileUnit cu)`
    `` | `public void` | `setEnclosingMethod(MethodNode enclosingMethod)` Sets the enclosing MethodNode for this local inner class.
    `` | `public void` | `setGenericsPlaceHolder(boolean placeholder)`
    `` | `public void` | `setGenericsTypes(GenericsType[] genericsTypes)` Sets the generic type parameters for this ClassNode.
    `` | `public void` | `setInterfaces(ClassNode[] interfaces)` Sets the interfaces implemented by this ClassNode.
    `` | `public void` | `setMixins(MixinNode[] mixins)`
    `` | `public void` | `setModifiers(int modifiers)` Sets the modifier flags for this ClassNode.
    `` | `public void` | `setModule(ModuleNode module)`
    `` | `public String` | `setName(String name)` Sets the fully-qualified name of this class, delegating to the redirect if one exists.
    `` | `public void` | `setOuterClassType(ClassNode outer)` Records the parameterized enclosing type of a JLS 4.5 rare type on this node.
    `` | `public void` | `setPermittedSubclasses(List<ClassNode> permittedSubclasses)`
    `` | `public void` | `setRecordComponents(List<RecordComponentNode> recordComponents)` Sets the record components for record type.
    `` | `public void` | `setRedirect(ClassNode node)` Sets this instance as a proxy for the given `ClassNode`, enabling deferred class resolution.
    `` | `public void` | `setScript(boolean script)` Marks this ClassNode as a script or removes the script flag.
    `` | `public void` | `setScriptBody(boolean scriptBody)` Marks this inner class or closure as being declared inside a script body.
    `` | `public void` | `setStaticClass(boolean staticClass)` Marks this inner class or closure as being declared in a static method context.
    `` | `public void` | `setSuperClass(ClassNode superClass)` Sets the super class of this ClassNode.
    `` | `public void` | `setSyntheticPublic(boolean syntheticPublic)` Marks this ClassNode as having synthetic public visibility.
    `` | `public void` | `setUnresolvedSuperClass(ClassNode superClass)` Sets the unresolved super class for this ClassNode.
    `` | `public void` | `setUsingGenerics(boolean usesGenerics)`
    `` | `public String` | `toString()` Returns a string representation of this ClassNode for debugging and display purposes.
    `` | `public String` | `toString(boolean showRedirect)` Returns a string representation of this ClassNode with optional redirect information.
    `` | `public MethodNode` | `tryFindPossibleMethod(String name, Expression arguments)`
    `` | `public void` | `visitContents(GroovyClassVisitor visitor)`

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class AnnotatedNode` | `addAnnotation, addAnnotation, addAnnotations, getAnnotations, getAnnotations, getDeclaringClass, getGroovydoc, getInstance, hasNoRealSourcePosition, isSynthetic, setDeclaringClass, setHasNoRealSourcePosition, setSynthetic`
    `class ASTNode` | `copyNodeMetaData, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getMetaDataMap, getText, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setMetaDataMap, setSourcePosition, visit`

- - ### Field Detail

    - #### public static final ClassNode[] EMPTY_ARRAY

    - #### public static final ClassNode SUPER

    - #### public static final ClassNode THIS

    - #### protected Class<?> clazz

    - #### protected boolean isPrimaryNode

    - #### protected final Object lazyInitLock

  - ### Constructor Detail

    - #### public ClassNode(String name, int modifiers, ClassNode superClass, ClassNode[] interfaces, MixinNode[] mixins)

      Constructs a primary `ClassNode` representing a class declaration with all components. This constructor creates a new ClassNode that will be compiled by Groovy. The node represents an actual source class definition with specified interfaces and mixins.

      Parameters:
        `name` - the fully-qualified name of the class (e.g., "com.example.MyClass")
        `modifiers` - the bytecode modifiers (flags from Modifier or org.objectweb.asm.Opcodes)
        `superClass` - the base class (ClassNode representing the parent type); use ClassHelper.OBJECT_TYPE if no direct base class
        `interfaces` - array of ClassNode instances for interfaces implemented by this class; may be empty
        `mixins` - array of MixinNode instances to be mixed into this class; may be empty

    - #### public ClassNode(String name, int modifiers, ClassNode superClass)

      Constructs a primary `ClassNode` representing a class declaration with superclass. This is a convenience constructor for creating classes with a single superclass and no interfaces or mixins. It delegates to the full constructor with empty interface and mixin arrays.

      Parameters:
        `name` - the fully-qualified name of the class (e.g., "com.example.MyClass")
        `modifiers` - the bytecode modifiers (flags from Modifier or org.objectweb.asm.Opcodes)
        `superClass` - the base class (ClassNode representing the parent type); use ClassHelper.OBJECT_TYPE if no direct base class

    - #### public ClassNode(Class<?> c)

      Constructs a non-primary `ClassNode` from a real Java class. This constructor creates a ClassNode that represents an actual Java class loaded at runtime (not a Groovy source class). The class information is lazily initialized from reflection, and the node will not be compiled by Groovy.

      Parameters:
        `c` - the Java class (Class) to wrap; must not be `null`

  - ### Method Detail

    - #### public void addConstructor(ConstructorNode node)

    - #### public ConstructorNode addConstructor(int modifiers, Parameter[] parameters, ClassNode[] exceptions, Statement code)

    - #### public void addField(FieldNode node)

      Adds a FieldNode to this ClassNode. The field is added to the end of the field list and its declaring class is set to this node's redirect target. The field is registered in the internal field index for fast lookup by name.

      Parameters:
        `node` - the FieldNode to add, must not be `null`
      See Also:
        addFieldFirst(FieldNode)
        removeField(String)

    - #### public FieldNode addField(String name, int modifiers, ClassNode type, Expression initialValue)

      Creates and adds a FieldNode to this ClassNode with the specified properties. The field is initialized with the given name, modifiers, type, and optional initial value expression. This is a convenience method that creates a FieldNode and adds it via addField(FieldNode).

      Parameters:
        `name` - the name of the field
        `modifiers` - the access modifiers for the field (e.g., ACC_PUBLIC, ACC_PRIVATE)
        `type` - the ClassNode representing the field's type
        `initialValue` - the initial value Expression, or `null` if no initializer
      Returns:
        the newly created FieldNode
      See Also:
        addFieldFirst(String, int, ClassNode, Expression)

    - #### public void addFieldFirst(FieldNode node)

      Adds a FieldNode to this ClassNode at the beginning of the field list. This method is similar to addField(FieldNode) but prepends the field instead of appending it, which can be useful when field declaration order matters.

      Parameters:
        `node` - the FieldNode to add first, must not be `null`
      See Also:
        addField(FieldNode)

    - #### public FieldNode addFieldFirst(String name, int modifiers, ClassNode type, Expression initialValue)

      Creates and adds a FieldNode to the beginning of this ClassNode's field list with the specified properties. This is a convenience method for adding fields where declaration order is significant.

      Parameters:
        `name` - the name of the field
        `modifiers` - the access modifiers for the field (e.g., ACC_PUBLIC, ACC_PRIVATE)
        `type` - the ClassNode representing the field's type
        `initialValue` - the initial value Expression, or `null` if no initializer
      Returns:
        the newly created FieldNode
      See Also:
        addField(String, int, ClassNode, Expression)

    - #### public void addInterface(ClassNode node)

      Adds an interface to the list of interfaces implemented by this ClassNode. If the interface is already implemented, this method has no effect. The interface is appended to the end of the current interfaces array.

      Parameters:
        `node` - the ClassNode representing the interface to add
      See Also:
        getInterfaces()
        setInterfaces(ClassNode[])

    - #### public void addMethod(MethodNode node)

      Adds a MethodNode to this ClassNode. The method is added to the internal methods list and registered by name in the methods map for fast lookup. The method's declaring class is set to this node's redirect target. This method does not check for duplicates.

      Parameters:
        `node` - the MethodNode to add, must not be `null`
      See Also:
        removeMethod(MethodNode)
        getMethod(String, Parameter[])
        MethodNode

    - #### public MethodNode addMethod(String name, int modifiers, ClassNode returnType, Parameter[] parameters, ClassNode[] exceptions, Statement code)

      Creates and adds a MethodNode to this ClassNode with the specified properties, but only if a method with the same name and parameter signature does not already exist. If a matching method is already declared in this class, it is returned without adding a new one. This method is useful for adding default method implementations (e.g., `getProperty()`, `invokeMethod()`) where the class may already have a user-defined version.

      Parameters:
        `name` - the name of the method
        `modifiers` - the access modifiers (e.g., ACC_PUBLIC, ACC_STATIC)
        `returnType` - the ClassNode representing the return type
        `parameters` - array of Parameters, or an empty array for no parameters
        `exceptions` - array of exception ClassNodes that the method declares, or an empty array
        `code` - the method body as a Statement, or `null`
      Returns:
        the newly created MethodNode or an existing method if one matches the name and parameters
      See Also:
        addMethod(MethodNode)
        getDeclaredMethod(String, Parameter[])

    - #### public void addMixin(MixinNode node)

    - #### public void addObjectInitializerStatements(Statement statement)

      Adds a statement to the object initializer.

      Parameters:
        `statement` - the statement to be added

    - #### public void addProperty(PropertyNode node)

      Adds a PropertyNode to this ClassNode. The property's associated field is also added to the field list, and the property itself is registered in the properties list. The property's declaring class is set to this node's redirect target.

      Parameters:
        `node` - the PropertyNode to add, must not be `null`
      See Also:
        addField(FieldNode)
        PropertyNode

    - #### public PropertyNode addProperty(String name, int modifiers, ClassNode type, Expression initialValue, Statement getterBlock, Statement setterBlock)

      Creates and adds a PropertyNode to this ClassNode with the specified properties, or returns an existing property with the same name if one is already present. If a property with the given name exists, the method updates its getter block, setter block, and initial value expression if they are currently `null`. This prevents duplicate properties while allowing partial initialization across multiple calls.

      Parameters:
        `name` - the name of the property
        `modifiers` - the access modifiers for the property (e.g., ACC_PUBLIC, ACC_PRIVATE)
        `type` - the ClassNode representing the property's type
        `initialValue` - the initial value Expression, or `null` if no initializer
        `getterBlock` - the getter method's Statement body, or `null`
        `setterBlock` - the setter method's Statement body, or `null`
      Returns:
        the newly created PropertyNode or the existing property if one with this name is already present
      See Also:
        addProperty(PropertyNode)
        PropertyNode

    - #### public void addStaticInitializerStatements(List<Statement> statements, boolean fieldInit)

    - #### public MethodNode addSyntheticMethod(String name, int modifiers, ClassNode returnType, Parameter[] parameters, ClassNode[] exceptions, Statement code)

      Adds a synthetic method as part of the compilation process.

    - #### public void addTransform(Class<? extends ASTTransformation> transform, ASTNode node)

    - #### public void addTypeAnnotation(AnnotationNode annotation)

    - #### public void addTypeAnnotations(List<AnnotationNode> annotations)

    - #### public GenericsType asGenericsType()

    - #### public boolean declaresAnyInterfaces(ClassNode classNodes)

      Parameters:
        `classNodes` - the class nodes for the interfaces
      Returns:
        `true` if this type declares that it implements any of the given interfaces or if one of its interfaces extends directly/indirectly any of the given interfaces

    - #### public boolean declaresInterface(ClassNode classNode)

      Parameters:
        `classNode` - the class node for the interface
      Returns:
        `true` if this class declares that it implements the given interface or if one of its interfaces extends directly/indirectly the interface NOTE: Doesn't consider an interface to implement itself. I think this is intended to be called on ClassNodes representing classes, not interfaces.
      See Also:
        GeneralUtils.isOrImplements

    - #### public boolean equals(Object that)

      Compares this ClassNode with another object for equality. Two ClassNodes are considered equal if:

      - They are the same object (identity check)
      - Both are ClassNode instances and either have identical redirects, identical component types (for arrays), or have matching text representations
      If this ClassNode is a redirect node, the comparison is delegated to the redirect target. Array ClassNodes are compared based on their component types.
      Parameters:
        `that` - the object to compare with this ClassNode
      Returns:
        `true` if the objects represent the same class; `false` otherwise
      See Also:
        hashCode()
        redirect()

    - #### public List<MethodNode> getAbstractMethods()

      Returns a list of all abstract MethodNodes declared in this ClassNode. Abstract methods are obtained from the declared methods map and filtered to return only those with the abstract modifier set. This includes abstract methods from superclasses and implemented interfaces.

      Returns:
        a list of abstract MethodNodes (possibly empty); returns an empty list if there are no abstract methods
      See Also:
        getDeclaredMethodsMap()
        MethodNode.isAbstract

    - #### public List<MethodNode> getAllDeclaredMethods()

      Returns all declared MethodNodes from this ClassNode and its superclasses and interfaces as a list. This is a convenience method that collects all values from the declared methods map into a single list.

      Returns:
        a list of all MethodNodes declared in this class, superclasses, and interfaces; an empty list if no methods are found
      See Also:
        getDeclaredMethodsMap()

    - #### public Set<ClassNode> getAllInterfaces()

    - #### public List<AnnotationNode> getAnnotations()

    - #### public List<AnnotationNode> getAnnotations(ClassNode type)

    - #### public CompileUnit getCompileUnit()

    - #### public ClassNode getComponentType()

      Returns the component type of this array ClassNode. If this ClassNode does not represent an array type, returns `null`. For array types, this returns the ClassNode representing the element type (e.g., for "String[]", returns the ClassNode for "String").

      Returns:
        the ClassNode representing the array's element type, or `null` if not an array

    - #### public ConstructorNode getDeclaredConstructor(Parameter[] parameters)

      Returns:
        the constructor matching the given parameters or `null`

    - #### public List<ConstructorNode> getDeclaredConstructors()

    - #### public FieldNode getDeclaredField(String name)

      Finds a FieldNode matching the given name declared directly in this class. This method does not search superclasses; to include inherited fields, use getField(String). If this node is a proxy (has a redirect), the call is forwarded to the redirect target.

      Parameters:
        `name` - the name of the field to find
      Returns:
        the FieldNode with the given name declared in this class, or `null` if not found
      See Also:
        getField(String)
        getFields()

    - #### public MethodNode getDeclaredMethod(String name, Parameter[] parameters)

      Finds a MethodNode matching the given name and parameter signature declared directly in this class. This method does not search superclasses; to include inherited methods, use getMethod(String, Parameter[]). Parameter matching is done by comparing parameter types using the parametersEqual(Parameter[], Parameter[]) method.

      Parameters:
        `name` - the name of the method to find
        `parameters` - an array of Parameters representing the method signature, or `null`/`empty` for methods with no parameters
      Returns:
        the MethodNode with the given name and parameters, or `null` if not found
      See Also:
        getMethod(String, Parameter[])
        getDeclaredMethods(String)

    - #### public List<MethodNode> getDeclaredMethods(String name)

      Returns a list of all MethodNodes with the given name declared directly in this class. This method does not search superclasses; to include inherited methods, use getMethods(String). If this node is a proxy (has a redirect), the call is forwarded to the redirect target. The list may be empty if no methods with the given name are declared in this class.

      Parameters:
        `name` - the name of the methods to find
      Returns:
        a list of MethodNodes with the given name (possibly empty)
      See Also:
        getMethods(String)
        getDeclaredMethod(String, Parameter[])

    - #### public Map<String, MethodNode> getDeclaredMethodsMap()

      Returns all declared MethodNodes from this ClassNode and its superclasses and interfaces. The methods are collected in a single map with method type descriptors as keys, allowing resolution of method overrides across the inheritance hierarchy. This method provides a complete view of all accessible methods.

      Returns:
        a map from method type descriptor (name and signature) to MethodNode; includes methods from superclasses and interfaces
      See Also:
        getDeclaredMethods(String)
        getMethod(String, Parameter[])
        MethodNode.getTypeDescriptor

    - #### public MethodNode getEnclosingMethod()

      Returns the enclosing MethodNode of this local inner class, or `null` if this is not a local inner class. Local inner classes are those declared within method bodies. If this ClassNode has a redirect, returns the enclosing method from the redirect.

      Returns:
        the MethodNode enclosing this class, or `null`
      See Also:
        setEnclosingMethod(MethodNode)
        getOuterClass()

    - #### public FieldNode getField(String name)

      Finds a FieldNode matching the given name in this class or any of its superclasses. This method searches the inheritance hierarchy starting from this ClassNode and moving up through superclasses until a field with the matching name is found.

      Parameters:
        `name` - the name of the field to find
      Returns:
        the FieldNode with the given name, or `null` if not found in this class or any superclass
      See Also:
        getDeclaredField(String)
        getFields()

    - #### @Deprecated(forRemoval = true, since = "5.0.0")
      public Map<String, FieldNode> getFieldIndex()

      Returns the internal field index map for fast field lookup by name. This method is deprecated as field access should go through getField(String) or getDeclaredField(String). The field index is an internal implementation detail and may change in future versions.

      deprecated:
        for removal since 5.0.0; use getField(String) or getDeclaredField(String) instead
      Returns:
        a map from field name to FieldNode, or `null` if no field index exists
      See Also:
        getField(String)
        getDeclaredField(String)

    - #### public List<FieldNode> getFields()

      Returns all FieldNodes declared in this ClassNode, including inherited fields. If this node is a proxy (has a redirect), the call is forwarded to the redirect target. The returned list includes fields from this class only, not from super classes.

      Returns:
        an unmodifiable or mutable list of FieldNodes associated with this ClassNode; an empty list if this class declares no fields
      See Also:
        getDeclaredField(String)
        FieldNode

    - #### public GenericsType[] getGenericsTypes()

      Returns the generic type parameters for this ClassNode, or `null` if none are defined. Generic types represent type parameters and their bounds as declared in class definitions. For example, in `class List<T>`, the GenericsType array would contain a single element representing the type parameter `T`.

      Returns:
        an array of GenericsType representing the type parameters, or `null`
      See Also:
        setGenericsTypes(GenericsType[])
        isUsingGenerics()

    - #### public MethodNode getGetterMethod(String getterName)

      Finds a getter MethodNode matching the given name, optionally searching superclasses. A getter method is defined as a method with no parameters that returns a non-void type. For methods starting with "is", the return type must be boolean. Synthetic and bridge methods are disregarded in favor of the most specific real getter.

      Parameters:
        `getterName` - the name of the getter method to find
      Returns:
        the getter MethodNode, or `null` if not found
      See Also:
        getGetterMethod(String, boolean)
        getSetterMethod(String)

    - #### public MethodNode getGetterMethod(String getterName, boolean searchSupers)

      Finds a getter MethodNode matching the given name, optionally searching superclasses and interfaces. A getter method is defined as a method with no parameters that returns a non-void type. For methods starting with "is", the return type must be boolean. Synthetic and bridge methods are disregarded in favor of the most specific real getter.

      Parameters:
        `getterName` - the name of the getter method to find
        `searchSupers` - if `true`, searches superclasses and interfaces for the getter; if `false`, searches only methods declared in this class
      Returns:
        the getter MethodNode, or `null` if not found
      See Also:
        getSetterMethod(String, boolean)
        MethodNode

    - #### public Iterator<InnerClassNode> getInnerClasses()

      Returns an iterator over the inner classes defined within this ClassNode. The iterator is backed by an unmodifiable view of the inner classes list. Returns an empty iterator if this class has no inner classes defined.

      Returns:
        an Iterator of InnerClassNodes defined in this class, never `null`
      See Also:
        addInnerClass(InnerClassNode)

    - #### public ClassNode[] getInterfaces()

      Returns:
        the interfaces implemented by this `ClassNode`

    - #### public MethodNode getMethod(String name, Parameter[] parameters)

      Finds a MethodNode matching the given name and parameter signature in this class or any of its superclasses. This method searches the inheritance hierarchy starting from this ClassNode. Parameter matching is done by comparing parameter types using the parametersEqual(Parameter[], Parameter[]) method.

      Parameters:
        `name` - the name of the method to find
        `parameters` - an array of Parameters representing the method signature, or `null`/`empty` for methods with no parameters
      Returns:
        the MethodNode with the given name and parameters, or `null` if not found in this class or any superclass
      See Also:
        getDeclaredMethod(String, Parameter[])
        getMethods(String)

    - #### public List<MethodNode> getMethods()

      Returns all MethodNodes declared in this ClassNode, including inherited and synthetic methods. If this node is a proxy (has a redirect), the call is forwarded to the redirect target. This list includes constructors and all instance and static methods defined for this class.

      Returns:
        a list of all MethodNodes associated with this ClassNode; an empty list if this class declares no methods
      See Also:
        getDeclaredMethods(String)
        getMethod(String, Parameter[])
        MethodNode

    - #### public List<MethodNode> getMethods(String name)

      Returns a list of all MethodNodes with the given name from this class and its superclasses. This method searches the inheritance hierarchy starting from this ClassNode and moving up through superclasses, collecting all methods with matching names. The list may be empty if no methods with the given name are found in the class hierarchy.

      Parameters:
        `name` - the name of the methods to find
      Returns:
        a list of MethodNodes with the given name from this class and its superclasses (possibly empty)
      See Also:
        getDeclaredMethods(String)
        getMethod(String, Parameter[])

    - #### public MixinNode[] getMixins()

      Returns:
        the mixins associated with this `ClassNode`

    - #### public int getModifiers()

      Returns the modifier flags for this ClassNode, combining visibility and behavioral modifiers. The flags are represented as a bitmask using ASM/bytecode conventions (e.g., `ACC_PUBLIC`, `ACC_ABSTRACT`, `ACC_INTERFACE`, `ACC_ENUM`). This method follows redirects if present, ensuring the modifiers of the actual target ClassNode are returned. Individual modifiers can be tested using bitwise AND operations with the ASM Opcodes constants.

      Returns:
        the modifier flags as an integer bitmask
      See Also:
        setModifiers(int)
        isAbstract()
        isStatic()
        isInterface()
        isEnum()

    - #### public ModuleNode getModule()

    - #### public String getName()

      Returns the fully-qualified name of this class after following any redirects. If this ClassNode is a proxy for another ClassNode, the name of the target is returned. The name remains consistent across all compilation phases for the redirected type.

      Returns:
        the fully-qualified class name (e.g., "com.example.MyClass" or "int[]")

    - #### public String getNameWithoutPackage()

    - #### public List<Statement> getObjectInitializerStatements()

    - #### public ClassNode getOuterClass()

      Returns the outer class of this ClassNode, or `null` if this is not an inner class. If this ClassNode has a redirect, returns the outer class from the redirect. This method traverses the class hierarchy upward to find the immediately enclosing class.

      Returns:
        the outer ClassNode, or `null` if not an inner class
      See Also:
        getOuterClasses()

    - #### public ClassNode getOuterClassType()

      For a JLS 4.5 rare type `Outer<T>.Inner`, the parameterized enclosing type stored on this node (type-use, not declaration; not node metadata and not redirected). Distinct from getOuterClass(), which is the enclosing class of a nested class declaration. Copied by getPlainNodeReference().

      Returns:
        the parameterized enclosing type, or `null` if this is not a rare type
      Since:
        6.0.0

    - #### public List<ClassNode> getOuterClasses()

      Returns a list of all outer classes enclosing this ClassNode in hierarchical order. The innermost outer class appears first in the list. Returns an empty list if this is not an inner class. If this ClassNode has a redirect, the list is derived from the redirect.

      Returns:
        a List of enclosing ClassNodes in order from innermost to outermost, never `null`
      See Also:
        getOuterClass()

    - #### public FieldNode getOuterField(String name)

      Returns:
        the field on the outer class or `null` if this is not an inner class

    - #### public PackageNode getPackage()

    - #### public String getPackageName()

    - #### public List<ClassNode> getPermittedSubclasses()

      Returns:
        permitted subclasses of sealed type, may initially be empty in early compiler phases

    - #### public ClassNode getPlainNodeReference()

    - #### public ClassNode getPlainNodeReference(boolean skipPrimitives)

    - #### public List<PropertyNode> getProperties()

      Returns all PropertyNodes declared in this ClassNode. If this node is a proxy (has a redirect), the call is forwarded to the redirect target. Properties are distinct from fields and represent a higher-level abstraction with getter/setter semantics.

      Returns:
        a mutable list of PropertyNodes associated with this ClassNode; an empty list if this class declares no properties
      See Also:
        getProperty(String)
        PropertyNode

    - #### public PropertyNode getProperty(String name)

      Finds a PropertyNode matching the given name in this ClassNode. This method searches through the properties list, comparing by name. Only direct properties of this class are searched, not inherited ones.

      Parameters:
        `name` - the name of the property to find
      Returns:
        the PropertyNode with the given name, or `null` if not found
      See Also:
        hasProperty(String)
        getProperties()

    - #### @Incubating
      public List<RecordComponentNode> getRecordComponents()

      Gets the record components of record type.

      Returns:
        `RecordComponentNode` instances
      Since:
        4.0.0

    - #### public MethodNode getSetterMethod(String setterName)

      Finds a setter MethodNode matching the given name, optionally searching superclasses. A setter method is defined as a method with exactly one parameter that returns void. This method searches from this class up the inheritance hierarchy until a matching setter is found.

      Parameters:
        `setterName` - the name of the setter method to find
      Returns:
        the setter MethodNode, or `null` if not found
      See Also:
        getSetterMethod(String, boolean)
        getGetterMethod(String)

    - #### public MethodNode getSetterMethod(String setterName, boolean voidOnly)

      Finds a setter MethodNode matching the given name. A setter method is defined as a method with exactly one parameter. If `voidOnly` is `true`, the method must also return void. The method searches this class and superclasses for the first matching setter.

      Parameters:
        `setterName` - the name of the setter method to find
        `voidOnly` - if `true`, only returns setter methods that return void; if `false`, accepts setters that return any type
      Returns:
        the setter MethodNode, or `null` if not found
      See Also:
        getGetterMethod(String, boolean)
        MethodNode

    - #### public ClassNode getSuperClass()

      Returns:
        the `ClassNode` of the super class of this type

    - #### public String getText()

    - #### public Map<Class<? extends ASTTransformation>, Set<ASTNode>> getTransforms(CompilePhase phase)

    - #### public List<AnnotationNode> getTypeAnnotations()

    - #### public List<AnnotationNode> getTypeAnnotations(ClassNode type)

    - #### public Class getTypeClass()

      Returns the concrete class this classnode relates to. However, this method is inherently unsafe as it may return null depending on the compile phase you are using. AST transformations should never use this method directly, but rather obtain a new class node using getPlainNodeReference().

      Returns:
        the class this classnode relates to. May return null.

    - #### public ClassNode[] getUnresolvedInterfaces()

      Returns the unresolved interfaces implemented by this ClassNode, using redirect resolution by default. The unresolved interfaces represent the raw interface hierarchy without applying redirect resolution. Returns an empty array if this class implements no interfaces.

      Returns:
        an array of ClassNode representing the interfaces, never `null`
      See Also:
        getUnresolvedInterfaces(boolean)

    - #### public ClassNode[] getUnresolvedInterfaces(boolean deref)

      Returns the unresolved interfaces implemented by this ClassNode with optional redirect resolution. When `deref` is `true`, resolves redirects recursively; otherwise returns the raw interfaces stored in this ClassNode. Resolving may trigger lazy class initialization.

      Parameters:
        `deref` - `true` to apply redirect resolution, `false` to return raw interfaces
      Returns:
        an array of ClassNode representing the interfaces, never `null`
      See Also:
        getUnresolvedInterfaces()

    - #### public String getUnresolvedName()

    - #### public ClassNode getUnresolvedSuperClass()

      Returns the unresolved super class of this ClassNode, using redirect resolution by default. The unresolved super class represents the raw class hierarchy without applying redirect resolution. Returns `null` if this class has no explicit superclass.

      Returns:
        the unresolved ClassNode representing the super class, or `null`
      See Also:
        getUnresolvedSuperClass(boolean)

    - #### public ClassNode getUnresolvedSuperClass(boolean deref)

      Returns the unresolved super class of this ClassNode with optional redirect resolution. When `deref` is `true`, resolves redirects recursively; otherwise returns the raw superclass stored in this ClassNode. Resolving may trigger lazy class initialization.

      Parameters:
        `deref` - `true` to apply redirect resolution, `false` to return raw superclass
      Returns:
        the unresolved ClassNode representing the super class, or `null`
      See Also:
        getUnresolvedSuperClass()

    - #### public boolean hasDeclaredMethod(String name, Parameter[] parameters)

      Tests whether a method with the given name and parameter signature is declared directly in this class (not inherited from a superclass). This is a convenience method for checking method existence.

      Parameters:
        `name` - the name of the method to check
        `parameters` - an array of Parameters representing the method signature, or `null`/`empty` for methods with no parameters
      Returns:
        `true` if a method with the given name and parameters is declared in this class, `false` otherwise
      See Also:
        getDeclaredMethod(String, Parameter[])
        hasMethod(String, Parameter[])

    - #### public boolean hasMethod(String name, Parameter[] parameters)

      Tests whether a method with the given name and parameter signature exists in this class or any of its superclasses. This is a convenience method for checking method existence.

      Parameters:
        `name` - the name of the method to check
        `parameters` - an array of Parameters representing the method signature, or `null`/`empty` for methods with no parameters
      Returns:
        `true` if a method with the given name and parameters exists, `false` otherwise
      See Also:
        getMethod(String, Parameter[])
        hasDeclaredMethod(String, Parameter[])

    - #### public boolean hasPackageName()

    - #### public boolean hasPossibleMethod(String name, Expression arguments)

      Determines if the type has a possibly-matching instance method with the given name and arguments.

      Parameters:
        `name` - the name of the method of interest
        `arguments` - the arguments to match against
      Returns:
        true if a matching method was found

    - #### public boolean hasPossibleStaticMethod(String name, Expression arguments)

      Checks if the given method has a possibly matching static method with the given name and arguments.

      Parameters:
        `name` - the name of the method of interest
        `arguments` - the arguments to match against
      Returns:
        `true` if a matching method was found

    - #### public boolean hasProperty(String name)

      Tests whether a property with the given name exists in this ClassNode. This method searches through the properties list, comparing by name.

      Parameters:
        `name` - the name of the property to check
      Returns:
        `true` if a property with the given name exists, `false` otherwise
      See Also:
        getProperty(String)
        getProperties()

    - #### public int hashCode()

      Returns the hash code for this ClassNode. The hash code is based on the redirect's hash code if a redirect exists, or the text representation's hash code if this is a primary or array ClassNode. This ensures that equal ClassNodes (by equals(Object)) have equal hash codes, maintaining the hash code contract for use in hash-based collections.

      Returns:
        a hash code value for this ClassNode
      See Also:
        equals(Object)

    - #### public boolean implementsAnyInterfaces(ClassNode classNodes)

      Parameters:
        `classNodes` - the class nodes for the interfaces
      Returns:
        `true` if this type implements any of the given interfaces

    - #### public boolean implementsInterface(ClassNode classNode)

      Parameters:
        `classNode` - the class node for the interface
      Returns:
        `true` if this type implements the given interface

    - #### public boolean isAbstract()

      Returns whether this ClassNode represents an abstract class. A class is abstract if the `ACC_ABSTRACT` modifier flag is set in its modifiers. Abstract classes cannot be instantiated directly; they serve as base types for subclasses. This method checks the actual modifier bits, independent of the source code syntax.

      Returns:
        `true` if this class has the abstract modifier set; `false` otherwise
      See Also:
        getModifiers()
        setModifiers(int)

    - #### public boolean isAnnotated()

      Returns whether this ClassNode has been marked as annotated. This flag is set to `true` when annotations are added to the class via addAnnotation(AnnotationNode) or related methods. It serves as a quick indicator that the class carries metadata annotations, without requiring iteration through the full annotations list. The flag does not distinguish between different types of annotations (type annotations, method annotations, etc.).

      Returns:
        `true` if this class has been marked as having annotations; `false` otherwise
      See Also:
        setAnnotated(boolean)
        getAnnotations()

    - #### public boolean isAnnotationDefinition()

      Returns whether this ClassNode represents an annotation type (annotation definition). Annotation types are always interfaces with both the `ACC_INTERFACE` and `ACC_ANNOTATION` modifier flags set. They define metadata that can be attached to program elements. All annotation types are interfaces but not all interfaces are annotations.

      Returns:
        `true` if this class is an annotation type; `false` otherwise
      See Also:
        isInterface()
        getModifiers()

    - #### public boolean isArray()

      Determines whether this ClassNode represents an array type. A ClassNode is an array if its component type has been set. The component type represents the element type of the array (e.g., "int" for "int[]", or "String" for "String[]").

      Returns:
        `true` if this ClassNode represents an array type; `false` if it represents a scalar type

    - #### public boolean isDerivedFrom(ClassNode type)

      Parameters:
        `type` - the ClassNode of interest
      Returns:
        true if this node is derived from the given ClassNode

    - #### public boolean isDerivedFromGroovyObject()

      Returns whether this ClassNode represents a type that implements the `GroovyObject` interface. GroovyObject is the core interface that all Groovy objects implement, providing methods like `getProperty()`, `setProperty()`, and `invokeMethod()` for dynamic behavior. This method checks the class hierarchy to determine if GroovyObject is in the list of implemented interfaces.

      Returns:
        `true` if this type directly or indirectly implements `GroovyObject`; `false` otherwise
      See Also:
        implementsInterface(ClassNode)
        isDerivedFrom(ClassNode)

    - #### public boolean isEnum()

      Returns whether this ClassNode represents an enumeration type. An enum class has the `ACC_ENUM` modifier flag set in its modifiers. Enumerations define a fixed set of named constants that can be iterated over at compile time.

      Returns:
        `true` if this class is an enumeration; `false` otherwise
      See Also:
        getModifiers()
        setModifiers(int)

    - #### public boolean isGenericsPlaceHolder()

    - #### public boolean isInterface()

      Returns whether this ClassNode represents an interface type. A class is an interface if the `ACC_INTERFACE` modifier flag is set in its modifiers. Interfaces define contracts for implementing classes without providing implementation details. Note that annotations are also interfaces (with the `ACC_ANNOTATION` flag also set).

      Returns:
        `true` if this class is an interface; `false` if it is a regular class
      See Also:
        isAnnotationDefinition()
        getModifiers()

    - #### public boolean isPrimaryClassNode()

      Determines whether this ClassNode is a primary node or redirects to one. A primary ClassNode represents actual Groovy source code that will be compiled into bytecode. Returns `true` if this node is primary or if its redirect target (or array component type) is a primary ClassNode. Non-primary nodes are typically loaded via reflection.

      Returns:
        `true` if this is a primary ClassNode or redirects to one; `false` if it only represents a reflected class

    - #### @Incubating
      public boolean isRecord()

      Checks if the ClassNode instance represents a native `record`. Check instead for the `RecordBase` annotation if looking for records and record-like classes currently being compiled.

      Returns:
        `true` if the instance represents a native `record`
      Since:
        4.0.0

    - #### public boolean isRedirectNode()

      Returns whether this ClassNode is a redirect (proxy) node for another ClassNode. A redirect node acts as a placeholder that forwards most method calls to its target ClassNode. This mechanism is used during compilation to defer class resolution until the actual target class is available. The actual target can be found using redirect().

      Returns:
        `true` if this node redirects to another ClassNode; `false` if it is a standalone node
      See Also:
        redirect()
        setRedirect(ClassNode)
        isPrimaryClassNode()

    - #### public boolean isResolved()

      Determines whether this ClassNode has been resolved to an actual Java class. A ClassNode is considered resolved if it represents a real Class object loaded at runtime, or if it has been redirected to a resolved ClassNode, or if it represents an array of resolved component types. During early compilation phases, unresolved ClassNodes may reference types that haven't been loaded yet.

      Returns:
        `true` if this ClassNode has been resolved to a real class; `false` if it still represents an unresolved reference

    - #### public boolean isScript()

      Returns whether this ClassNode represents a Groovy script body. A script is a special class that executes at the top level rather than requiring instantiation. This method checks both the direct flag and whether the class derives from `Script`. During compilation, script bodies are compiled into classes that extend the `Script` base class.

      Returns:
        `true` if this class represents a script; `false` otherwise
      See Also:
        setScript(boolean)
        isScriptBody()
        isDerivedFrom(ClassNode)

    - #### public boolean isScriptBody()

      Returns whether this inner class or closure was declared inside a script body. This flag distinguishes between inner classes/closures defined within a script's top-level code versus those defined within regular class methods. Script body context affects how local variable access and scoping rules are applied. This method follows redirects if present.

      Returns:
        `true` if this inner class or closure is inside a script body; `false` otherwise
      See Also:
        setScriptBody(boolean)
        isScript()
        isStaticClass()

    - #### public boolean isSealed()

      Returns:
        `true` for native and emulated (annotation based) sealed classes
      Since:
        4.0.0

    - #### public boolean isStatic()

      Returns whether this ClassNode represents a static class. A class is static if the `ACC_STATIC` modifier flag is set in its modifiers. Static nested classes have no enclosing instance; they can be used without an instance of the enclosing class. This method checks the actual modifier bits, independent of the source code syntax.

      Returns:
        `true` if this class has the static modifier set; `false` otherwise
      See Also:
        getModifiers()
        setModifiers(int)
      Since:
        6.0.0

    - #### public boolean isStaticClass()

      Returns whether this inner class or closure was declared inside a static method context. This flag identifies classes that are nested within static methods (as opposed to instance methods or top-level definitions). Inner classes in static contexts have different scoping rules and cannot access instance variables of the enclosing class. This method follows redirects if present.

      Returns:
        `true` if this class is declared in a static method; `false` otherwise
      See Also:
        setStaticClass(boolean)
        isStatic()
        isScriptBody()

    - #### public boolean isSyntheticPublic()

      Indicates that this class has been "promoted" to public by Groovy when in fact there was no public modifier explicitly in the source code. That is, it remembers that it has applied Groovy's "public classes by default" rule. This property is typically only of interest to AST transform writers.

      Returns:
        `true` if node is public but had no explicit public modifier

    - #### public boolean isUsingGenerics()

    - #### public ClassNode makeArray()

      Returns a `ClassNode` representing an array of the type represented by this.

    - #### @Deprecated(forRemoval = true, since = "4.0.0")
      protected boolean parametersEqual(Parameter[] a, Parameter[] b)

    - #### public void positionStmtsAfterEnumInitStmts(List<Statement> staticFieldInitializerStatements)

    - #### public ClassNode redirect()

      Returns the `ClassNode` this node is a proxy for or the node itself. If this ClassNode has been set as a proxy to another ClassNode via setRedirect(ClassNode), recursively follows the redirect chain to return the ultimate target ClassNode. If no redirect is set, returns `this`. This mechanism allows lazy resolution of class references during compilation.

      Returns:
        the final ClassNode in the redirect chain; never `null`

    - #### public void removeConstructor(ConstructorNode node)

    - #### public void removeField(String oldName)

      Removes the FieldNode with the given name from this ClassNode. This method removes the field from the internal field list and index. If this node is a proxy (has a redirect), the operation is performed on the redirect target.

      Parameters:
        `oldName` - the name of the field to remove
      See Also:
        addField(FieldNode)
        getField(String)
        FieldNode

    - #### public void removeMethod(MethodNode node)

      Removes the given MethodNode from this ClassNode. The method is removed from the internal methods list and the methods map. If this node is a proxy (has a redirect), the operation is performed on the redirect target.

      Parameters:
        `node` - the MethodNode to remove
      See Also:
        addMethod(MethodNode)
        getMethod(String, Parameter[])
        MethodNode

    - #### public void renameField(String oldName, String newName)

    - #### public void setAnnotated(boolean annotated)

      Marks this ClassNode as having annotations attached to it. This flag is used internally by the compiler to track whether annotations have been added to the class. It should be set to `true` when annotations are added and may be used as an optimization to avoid scanning the annotations list for empty cases.

      Parameters:
        `annotated` - `true` to mark as having annotations; `false` to clear the flag
      See Also:
        isAnnotated()
        addAnnotation(AnnotationNode)
        addTypeAnnotation(AnnotationNode)

    - #### @Deprecated(forRemoval = true, since = "5.0.0")
      protected void setCompileUnit(CompileUnit cu)

    - #### public void setEnclosingMethod(MethodNode enclosingMethod)

      Sets the enclosing MethodNode for this local inner class. This is typically called when processing classes declared within method bodies.

      Parameters:
        `enclosingMethod` - the MethodNode enclosing this class, or `null`
      See Also:
        getEnclosingMethod()

    - #### public void setGenericsPlaceHolder(boolean placeholder)

    - #### public void setGenericsTypes(GenericsType[] genericsTypes)

      Sets the generic type parameters for this ClassNode. Setting generics types updates the generics usage indicator for this class. This method is typically called during compiler phases when type information becomes available.

      Parameters:
        `genericsTypes` - an array of GenericsType representing the type parameters, or `null`
      See Also:
        getGenericsTypes()
        isUsingGenerics()

    - #### public void setInterfaces(ClassNode[] interfaces)

      Sets the interfaces implemented by this ClassNode. If this ClassNode has a redirect, the interfaces are set on the redirect instead. Updates the generics usage indicator if any interface uses generics and this is a primary ClassNode.

      Parameters:
        `interfaces` - an array of ClassNode representing the interfaces, or `null`
      See Also:
        getInterfaces()
        addInterface(ClassNode)
        isUsingGenerics()

    - #### public void setMixins(MixinNode[] mixins)

    - #### public void setModifiers(int modifiers)

      Sets the modifier flags for this ClassNode. The modifiers are a bitmask of ASM/bytecode convention flags (e.g., `ACC_PUBLIC`, `ACC_ABSTRACT`, `ACC_INTERFACE`, `ACC_ENUM`). Calling this method directly on a redirect node updates the redirect's modifiers instead of this node's. Use this method to control visibility and structural attributes like abstractness or finality.

      Parameters:
        `modifiers` - the new modifier flags as a bitmask
      See Also:
        getModifiers()
        isAbstract()
        isInterface()

    - #### public void setModule(ModuleNode module)

    - #### public String setName(String name)

      Sets the fully-qualified name of this class, delegating to the redirect if one exists. Allows the class name to be updated after construction, which is occasionally used during AST transformation phases. Changes are propagated to the redirect target if present.

      Parameters:
        `name` - the new fully-qualified class name to set
      Returns:
        the name that was set

    - #### public void setOuterClassType(ClassNode outer)

      Records the parameterized enclosing type of a JLS 4.5 rare type on this node. Does not write through redirect().

      Parameters:
        `outer` - the parameterized `Outer<T>` node; `null` clears it
      Since:
        6.0.0

    - #### public void setPermittedSubclasses(List<ClassNode> permittedSubclasses)

    - #### @Incubating
      public void setRecordComponents(List<RecordComponentNode> recordComponents)

      Sets the record components for record type.

      Since:
        4.0.0

    - #### public void setRedirect(ClassNode node)

      Sets this instance as a proxy for the given `ClassNode`, enabling deferred class resolution. After calling this method, most operations on this ClassNode are forwarded to the target ClassNode. Redirect is only allowed for non-primary ClassNodes (see isPrimaryClassNode()). If the target is `null`, the redirect is removed, making this node standalone again.

      throws:
        GroovyBugError if this is a primary ClassNode, as redirects are only for proxy nodes
      Parameters:
        `node` - the ClassNode to redirect to; if `null` the redirect is cleared

    - #### public void setScript(boolean script)

      Marks this ClassNode as a script or removes the script flag. Setting this to `true` indicates that this class represents a Groovy script that should be executed at the top level. This is used internally during compilation to identify script classes that need special treatment (e.g., extending the Script base class).

      Parameters:
        `script` - `true` to mark as a script; `false` to unmark
      See Also:
        isScript()
        setScriptBody(boolean)

    - #### public void setScriptBody(boolean scriptBody)

      Marks this inner class or closure as being declared inside a script body. When set to `true`, indicates that the class definition occurs at the top level of a Groovy script (outside of any method or class definition). This affects variable scoping and how the compiler generates code for accessing enclosing scope variables. Typically used by the compiler during script class generation.

      Parameters:
        `scriptBody` - `true` to mark as defined in script body; `false` otherwise
      See Also:
        isScriptBody()
        setStaticClass(boolean)

    - #### public void setStaticClass(boolean staticClass)

      Marks this inner class or closure as being declared in a static method context. When set to `true`, indicates that this class definition occurs within a static method, affecting how the compiler generates access to enclosing class members. Static inner classes have restricted access to the enclosing class (only to static members).

      Parameters:
        `staticClass` - `true` to mark as defined in a static context; `false` otherwise
      See Also:
        isStaticClass()
        isStatic()
        setScriptBody(boolean)

    - #### public void setSuperClass(ClassNode superClass)

      Sets the super class of this ClassNode. If this ClassNode has a redirect, the super class is set on the redirect instead. Updates the generics usage indicator if the super class uses generics and this is a primary ClassNode.

      Parameters:
        `superClass` - the ClassNode representing the super class, or `null`
      See Also:
        getSuperClass()
        isUsingGenerics()

    - #### public void setSyntheticPublic(boolean syntheticPublic)

      Marks this ClassNode as having synthetic public visibility. When set to `true`, indicates that this class was implicitly made public by Groovy's default visibility rule rather than having an explicit `public` modifier in the source code. This distinction is important for AST transformations that need to preserve the original intent regarding visibility and access control.

      Parameters:
        `syntheticPublic` - `true` if public was added by the compiler; `false` if explicitly declared
      See Also:
        isSyntheticPublic()
        getModifiers()

    - #### public void setUnresolvedSuperClass(ClassNode superClass)

      Sets the unresolved super class for this ClassNode. This method sets the raw superclass without applying any redirect resolution.

      Parameters:
        `superClass` - the ClassNode representing the super class, or `null`

    - #### public void setUsingGenerics(boolean usesGenerics)

    - #### public String toString()

      Returns a string representation of this ClassNode for debugging and display purposes. For array types, appends "[]" to the component type's string representation. For generic types, includes generic type parameters (e.g., "List"). If this is a redirect node, includes arrow notation showing the redirect target.

      Returns:
        a string representation of this ClassNode, including fully-qualified name and type information

    - #### public String toString(boolean showRedirect)

      Returns a string representation of this ClassNode with optional redirect information. For array types, appends "[]" to the component type's string representation. For generic types, includes generic type parameters (e.g., "List"). If `showRedirect` is `true` and this is a redirect node, includes arrow notation showing the redirect target; otherwise the redirect information is omitted.

      Parameters:
        `showRedirect` - if `true`, includes redirect information in the output; if `false`, omits it
      Returns:
        a string representation of this ClassNode

    - #### public MethodNode tryFindPossibleMethod(String name, Expression arguments)

    - #### public void visitContents(GroovyClassVisitor visitor)