ClassNode (Groovy 5.0.7)
Description: declaration: package: org.codehaus.groovy.ast, class: ClassNode

Package org.codehaus.groovy.ast

# Class ClassNode

java.lang.Object
org.codehaus.groovy.ast.ASTNode
org.codehaus.groovy.ast.AnnotatedNode
org.codehaus.groovy.ast.ClassNode

All Implemented Interfaces:
  `GroovydocHolder<AnnotatedNode>`, `NodeMetaDataHandler`

Direct Known Subclasses:
  `DecompiledClassNode`, `InnerClassNode`, `MixinNode`, `WideningCategories.LowestUpperBoundClassNode`

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.

See Also:
  - `ClassHelper`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected Class<?>`
  `clazz`
  `static final ClassNode[]`
  `EMPTY_ARRAY`
  `protected boolean`
  `isPrimaryNode`
  `protected final Object`
  `lazyInitLock`
  `static final ClassNode`
  `SUPER`
  `static final ClassNode`
  `THIS`

  ### Fields inherited from interface groovy.lang.groovydoc.GroovydocHolder

  `DOC_COMMENT`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ClassNode(Class<?> c)`
  Creates a non-primary `ClassNode` from a real class.
  `ClassNode(String name, int modifiers, ClassNode superClass)`
  `ClassNode(String name, int modifiers, ClassNode superClass, ClassNode[] interfaces, MixinNode[] mixins)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `ConstructorNode`
  `addConstructor(int modifiers, Parameter[] parameters, ClassNode[] exceptions, Statement code)`
  `void`
  `addConstructor(ConstructorNode node)`
  `FieldNode`
  `addField(String name, int modifiers, ClassNode type, Expression initialValue)`
  `void`
  `addField(FieldNode node)`
  `FieldNode`
  `addFieldFirst(String name, int modifiers, ClassNode type, Expression initialValue)`
  `void`
  `addFieldFirst(FieldNode node)`
  `void`
  `addInterface(ClassNode node)`
  `MethodNode`
  `addMethod(String name, int modifiers, ClassNode returnType, Parameter[] parameters, ClassNode[] exceptions, Statement code)`
  If a method with the given name and parameters is already defined then it is returned otherwise the given method is added to this node.
  `void`
  `addMethod(MethodNode node)`
  `void`
  `addMixin(MixinNode node)`
  `void`
  `addObjectInitializerStatements(Statement statement)`
  Adds a statement to the object initializer.
  `PropertyNode`
  `addProperty(String name, int modifiers, ClassNode type, Expression initialValue, Statement getterBlock, Statement setterBlock)`
  `void`
  `addProperty(PropertyNode node)`
  `void`
  `addStaticInitializerStatements(List<Statement> statements, boolean fieldInit)`
  `MethodNode`
  `addSyntheticMethod(String name, int modifiers, ClassNode returnType, Parameter[] parameters, ClassNode[] exceptions, Statement code)`
  Adds a synthetic method as part of the compilation process.
  `void`
  `addTransform(Class<? extends ASTTransformation> transform, ASTNode node)`
  `void`
  `addTypeAnnotation(AnnotationNode annotation)`
  `void`
  `addTypeAnnotations(List<AnnotationNode> annotations)`
  `GenericsType`
  `asGenericsType()`
  `boolean`
  `declaresAnyInterfaces(ClassNode... classNodes)`
  `boolean`
  `declaresInterface(ClassNode classNode)`
  `boolean`
  `equals(Object that)`
  `List<MethodNode>`
  `getAbstractMethods()`
  `List<MethodNode>`
  `getAllDeclaredMethods()`
  `Set<ClassNode>`
  `getAllInterfaces()`
  `List<AnnotationNode>`
  `getAnnotations()`
  `List<AnnotationNode>`
  `getAnnotations(ClassNode type)`
  `CompileUnit`
  `getCompileUnit()`
  `ClassNode`
  `getComponentType()`
  `ConstructorNode`
  `getDeclaredConstructor(Parameter[] parameters)`
  `List<ConstructorNode>`
  `getDeclaredConstructors()`
  `FieldNode`
  `getDeclaredField(String name)`
  Finds a field matching the given name in this class.
  `MethodNode`
  `getDeclaredMethod(String name, Parameter[] parameters)`
  Finds a method matching the given name and parameters in this class.
  `List<MethodNode>`
  `getDeclaredMethods(String name)`
  Returns a list of all methods with the given name from this class.
  `Map<String,MethodNode>`
  `getDeclaredMethodsMap()`
  `MethodNode`
  `getEnclosingMethod()`
  The enclosing method of local inner class.
  `FieldNode`
  `getField(String name)`
  Finds a field matching the given name in this class or a parent class.
  `Map<String,FieldNode>`
  `getFieldIndex()`
  Deprecated, for removal: This API element is subject to removal in a future version.
  `List<FieldNode>`
  `getFields()`
  `GenericsType[]`
  `getGenericsTypes()`
  `MethodNode`
  `getGetterMethod(String getterName)`
  `MethodNode`
  `getGetterMethod(String getterName, boolean searchSupers)`
  `Iterator<InnerClassNode>`
  `getInnerClasses()`
  `ClassNode[]`
  `getInterfaces()`
  `MethodNode`
  `getMethod(String name, Parameter[] parameters)`
  Finds a method matching the given name and parameters in this class or any super class.
  `List<MethodNode>`
  `getMethods()`
  `List<MethodNode>`
  `getMethods(String name)`
  Returns a list of all methods with the given name from this class and its super class(es).
  `MixinNode[]`
  `getMixins()`
  `int`
  `getModifiers()`
  `ModuleNode`
  `getModule()`
  `String`
  `getName()`
  `String`
  `getNameWithoutPackage()`
  `List<Statement>`
  `getObjectInitializerStatements()`
  `ClassNode`
  `getOuterClass()`
  `List<ClassNode>`
  `getOuterClasses()`
  `FieldNode`
  `getOuterField(String name)`
  `PackageNode`
  `getPackage()`
  `String`
  `getPackageName()`
  `List<ClassNode>`
  `getPermittedSubclasses()`
  `ClassNode`
  `getPlainNodeReference()`
  `ClassNode`
  `getPlainNodeReference(boolean skipPrimitives)`
  `List<PropertyNode>`
  `getProperties()`
  `PropertyNode`
  `getProperty(String name)`
  `List<RecordComponentNode>`
  `getRecordComponents()`
  Gets the record components of record type.
  `MethodNode`
  `getSetterMethod(String setterName)`
  `MethodNode`
  `getSetterMethod(String setterName, boolean voidOnly)`
  `ClassNode`
  `getSuperClass()`
  `String`
  `getText()`
  `Map<Class<? extends ASTTransformation>,Set<ASTNode>>`
  `getTransforms(CompilePhase phase)`
  `List<AnnotationNode>`
  `getTypeAnnotations()`
  `List<AnnotationNode>`
  `getTypeAnnotations(ClassNode type)`
  `Class`
  `getTypeClass()`
  Returns the concrete class this classnode relates to.
  `ClassNode[]`
  `getUnresolvedInterfaces()`
  `ClassNode[]`
  `getUnresolvedInterfaces(boolean deref)`
  `String`
  `getUnresolvedName()`
  `ClassNode`
  `getUnresolvedSuperClass()`
  `ClassNode`
  `getUnresolvedSuperClass(boolean deref)`
  `boolean`
  `hasDeclaredMethod(String name, Parameter[] parameters)`
  `int`
  `hashCode()`
  `boolean`
  `hasMethod(String name, Parameter[] parameters)`
  `boolean`
  `hasPackageName()`
  `boolean`
  `hasPossibleMethod(String name, Expression arguments)`
  Determines if the type has a possibly-matching instance method with the given name and arguments.
  `boolean`
  `hasPossibleStaticMethod(String name, Expression arguments)`
  Checks if the given method has a possibly matching static method with the given name and arguments.
  `boolean`
  `hasProperty(String name)`
  `boolean`
  `implementsAnyInterfaces(ClassNode... classNodes)`
  `boolean`
  `implementsInterface(ClassNode classNode)`
  `boolean`
  `isAbstract()`
  `boolean`
  `isAnnotated()`
  `boolean`
  `isAnnotationDefinition()`
  `boolean`
  `isArray()`
  `boolean`
  `isDerivedFrom(ClassNode type)`
  `boolean`
  `isDerivedFromGroovyObject()`
  `boolean`
  `isEnum()`
  `boolean`
  `isGenericsPlaceHolder()`
  `boolean`
  `isInterface()`
  `boolean`
  `isPrimaryClassNode()`
  `boolean`
  `isRecord()`
  Checks if the `ClassNode` instance represents a native `record`.
  `boolean`
  `isRedirectNode()`
  `boolean`
  `isResolved()`
  `boolean`
  `isScript()`
  `boolean`
  `isScriptBody()`
  `boolean`
  `isSealed()`
  `boolean`
  `isStaticClass()`
  Is this class declared in a static method (such as a closure / inner class declared in a static method)
  `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.
  `boolean`
  `isUsingGenerics()`
  `ClassNode`
  `makeArray()`
  Returns a `ClassNode` representing an array of the type represented by this.
  `protected boolean`
  `parametersEqual(Parameter[] a, Parameter[] b)`
  Deprecated, for removal: This API element is subject to removal in a future version.
  `void`
  `positionStmtsAfterEnumInitStmts(List<Statement> staticFieldInitializerStatements)`
  `ClassNode`
  `redirect()`
  Returns the `ClassNode` this node is a proxy for or the node itself.
  `void`
  `removeConstructor(ConstructorNode node)`
  `void`
  `removeField(String oldName)`
  `void`
  `removeMethod(MethodNode node)`
  `void`
  `renameField(String oldName, String newName)`
  `void`
  `setAnnotated(boolean annotated)`
  `protected void`
  `setCompileUnit(CompileUnit cu)`
  Deprecated, for removal: This API element is subject to removal in a future version.
  `void`
  `setEnclosingMethod(MethodNode enclosingMethod)`
  `void`
  `setGenericsPlaceHolder(boolean placeholder)`
  `void`
  `setGenericsTypes(GenericsType[] genericsTypes)`
  `void`
  `setInterfaces(ClassNode[] interfaces)`
  `void`
  `setMixins(MixinNode[] mixins)`
  `void`
  `setModifiers(int modifiers)`
  `void`
  `setModule(ModuleNode module)`
  `String`
  `setName(String name)`
  `void`
  `setPermittedSubclasses(List<ClassNode> permittedSubclasses)`
  `void`
  `setRecordComponents(List<RecordComponentNode> recordComponents)`
  Sets the record components for record type.
  `void`
  `setRedirect(ClassNode node)`
  Sets this instance as proxy for the given `ClassNode`.
  `void`
  `setScript(boolean script)`
  `void`
  `setScriptBody(boolean scriptBody)`
  `void`
  `setStaticClass(boolean staticClass)`
  `void`
  `setSuperClass(ClassNode superClass)`
  `void`
  `setSyntheticPublic(boolean syntheticPublic)`
  `void`
  `setUnresolvedSuperClass(ClassNode superClass)`
  `void`
  `setUsingGenerics(boolean usesGenerics)`
  `String`
  `toString()`
  `String`
  `toString(boolean showRedirect)`
  `MethodNode`
  `tryFindPossibleMethod(String name, Expression arguments)`
  `void`
  `visitContents(GroovyClassVisitor visitor)`

  ### Methods inherited from class org.codehaus.groovy.ast.AnnotatedNode

  `addAnnotation, addAnnotation, addAnnotations, getDeclaringClass, getGroovydoc, getInstance, hasNoRealSourcePosition, isSynthetic, setDeclaringClass, setHasNoRealSourcePosition, setSynthetic`

  ### Methods inherited from class org.codehaus.groovy.ast.ASTNode

  `copyNodeMetaData, getColumnNumber, getLastColumnNumber, getLastLineNumber, getLineNumber, getMetaDataMap, setColumnNumber, setLastColumnNumber, setLastLineNumber, setLineNumber, setMetaDataMap, setSourcePosition, visit`

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface org.codehaus.groovy.ast.NodeMetaDataHandler

  `copyNodeMetaData, getNodeMetaData, getNodeMetaData, getNodeMetaData, newMetaDataMap, putNodeMetaData, removeNodeMetaData, setNodeMetaData`

- ## Field Details

  - ### EMPTY_ARRAY

    public static final ClassNode[] EMPTY_ARRAY

  - ### THIS

    public static final ClassNode THIS

  - ### SUPER

    public static final ClassNode SUPER

  - ### isPrimaryNode

    protected boolean isPrimaryNode

  - ### lazyInitLock

    protected final Object lazyInitLock

  - ### clazz

    protected Class<?> clazz

- ## Constructor Details

  - ### ClassNode

    public ClassNode(String name, int modifiers, ClassNode superClass, ClassNode[] interfaces, MixinNode[] mixins)
    Parameters:
      `name` - the fully-qualified name of the class
      `modifiers` - the modifiers; see `Modifier` or `Opcodes`
      `superClass` - the base class; use "java.lang.Object" if no direct base class
      `interfaces` - the interfaces
      `mixins` - the mixins

  - ### ClassNode

    public ClassNode(String name, int modifiers, ClassNode superClass)
    Parameters:
      `name` - the fully-qualified name of the class
      `modifiers` - the modifiers; see `Modifier` or `Opcodes`
      `superClass` - the base class; use "java.lang.Object" if no direct base class

  - ### ClassNode

    public ClassNode(Class<?> c)
    Creates a non-primary `ClassNode` from a real class.

- ## Method Details

  - ### redirect

    public ClassNode redirect()
    Returns the `ClassNode` this node is a proxy for or the node itself.

  - ### isRedirectNode

    public boolean isRedirectNode()

  - ### setRedirect

    public void setRedirect(ClassNode node)
    Sets this instance as proxy for the given `ClassNode`.
    Parameters:
      `node` - the class to redirect to; if `null` the redirect is removed

  - ### isPrimaryClassNode

    public boolean isPrimaryClassNode()
    Returns:
      `true` if this instance is a primary `ClassNode`

  - ### getPlainNodeReference

    public ClassNode getPlainNodeReference()

  - ### getPlainNodeReference

    public ClassNode getPlainNodeReference(boolean skipPrimitives)

  - ### getModule

    public ModuleNode getModule()

  - ### setModule

    public void setModule(ModuleNode module)

  - ### getCompileUnit

    public CompileUnit getCompileUnit()

  - ### setCompileUnit

    @Deprecated(forRemoval=true, since="5.0.0") protected void setCompileUnit(CompileUnit cu)
    Deprecated, for removal: This API element is subject to removal in a future version.

  - ### getPackage

    public PackageNode getPackage()

  - ### getPackageName

    public String getPackageName()

  - ### hasPackageName

    public boolean hasPackageName()

  - ### getNameWithoutPackage

    public String getNameWithoutPackage()

  - ### getUnresolvedName

    public String getUnresolvedName()

  - ### getUnresolvedSuperClass

    public ClassNode getUnresolvedSuperClass()

  - ### getUnresolvedSuperClass

    public ClassNode getUnresolvedSuperClass(boolean deref)

  - ### setUnresolvedSuperClass

    public void setUnresolvedSuperClass(ClassNode superClass)

  - ### getUnresolvedInterfaces

    public ClassNode[] getUnresolvedInterfaces()

  - ### getUnresolvedInterfaces

    public ClassNode[] getUnresolvedInterfaces(boolean deref)

  - ### getText

    public String getText()
    Overrides:
      `getText` in class `ASTNode`

  - ### getName

    public String getName()

  - ### setName

    public String setName(String name)

  - ### getModifiers

    public int getModifiers()

  - ### setModifiers

    public void setModifiers(int modifiers)

  - ### getSuperClass

    public ClassNode getSuperClass()
    Returns:
      the `ClassNode` of the super class of this type

  - ### setSuperClass

    public void setSuperClass(ClassNode superClass)

  - ### getInterfaces

    public ClassNode[] getInterfaces()
    Returns:
      the interfaces implemented by this `ClassNode`

  - ### getAllInterfaces

    public Set<ClassNode> getAllInterfaces()

  - ### setInterfaces

    public void setInterfaces(ClassNode[] interfaces)

  - ### getMixins

    public MixinNode[] getMixins()
    Returns:
      the mixins associated with this `ClassNode`

  - ### setMixins

    public void setMixins(MixinNode[] mixins)

  - ### getPermittedSubclasses

    @Incubating public List<ClassNode> getPermittedSubclasses()
    Returns:
      permitted subclasses of sealed type, may initially be empty in early compiler phases

  - ### setPermittedSubclasses

    @Incubating public void setPermittedSubclasses(List<ClassNode> permittedSubclasses)

  - ### getRecordComponents

    @Incubating public List<RecordComponentNode> getRecordComponents()
    Gets the record components of record type.
    Returns:
      `RecordComponentNode` instances
    Since:
      4.0.0

  - ### setRecordComponents

    @Incubating public void setRecordComponents(List<RecordComponentNode> recordComponents)
    Sets the record components for record type.
    Since:
      4.0.0

  - ### addInterface

    public void addInterface(ClassNode node)

  - ### addMixin

    public void addMixin(MixinNode node)

  - ### addField

    public void addField(FieldNode node)

  - ### addField

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

  - ### addFieldFirst

    public void addFieldFirst(FieldNode node)

  - ### addFieldFirst

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

  - ### addProperty

    public void addProperty(PropertyNode node)

  - ### addProperty

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

  - ### addMethod

    public void addMethod(MethodNode node)

  - ### addMethod

    public MethodNode addMethod(String name, int modifiers, ClassNode returnType, Parameter[] parameters, ClassNode[] exceptions, Statement code)
    If a method with the given name and parameters is already defined then it is returned otherwise the given method is added to this node. This method is useful for default method adding like getProperty() or invokeMethod() where there may already be a method defined in a class and so the default implementations should not be added if already present.

  - ### addSyntheticMethod

    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.

  - ### addConstructor

    public void addConstructor(ConstructorNode node)

  - ### addConstructor

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

  - ### addObjectInitializerStatements

    public void addObjectInitializerStatements(Statement statement)
    Adds a statement to the object initializer.
    Parameters:
      `statement` - the statement to be added

  - ### addStaticInitializerStatements

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

  - ### positionStmtsAfterEnumInitStmts

    public void positionStmtsAfterEnumInitStmts(List<Statement> staticFieldInitializerStatements)

  - ### getFields

    public List<FieldNode> getFields()
    Returns:
      the fields associated with this `ClassNode`

  - ### getProperties

    public List<PropertyNode> getProperties()

  - ### getFieldIndex

    @Deprecated(forRemoval=true, since="5.0.0") public Map<String,FieldNode> getFieldIndex()
    Deprecated, for removal: This API element is subject to removal in a future version.

  - ### hasProperty

    public boolean hasProperty(String name)

  - ### getProperty

    public PropertyNode getProperty(String name)

  - ### getMethods

    public List<MethodNode> getMethods()
    Returns:
      the methods associated with this `ClassNode`

  - ### getAbstractMethods

    public List<MethodNode> getAbstractMethods()
    Returns:
      the abstract methods associated with this `ClassNode`

  - ### getAllDeclaredMethods

    public List<MethodNode> getAllDeclaredMethods()

  - ### getDeclaredMethodsMap

    public Map<String,MethodNode> getDeclaredMethodsMap()

  - ### getDeclaredConstructors

    public List<ConstructorNode> getDeclaredConstructors()

  - ### getDeclaredConstructor

    public ConstructorNode getDeclaredConstructor(Parameter[] parameters)
    Returns:
      the constructor matching the given parameters or `null`

  - ### hasMethod

    public boolean hasMethod(String name, Parameter[] parameters)
    See Also:
      - `getMethod(String, Parameter[])`

  - ### hasDeclaredMethod

    public boolean hasDeclaredMethod(String name, Parameter[] parameters)
    See Also:
      - `getDeclaredMethod(String, Parameter[])`

  - ### getDeclaredField

    public FieldNode getDeclaredField(String name)
    Finds a field matching the given name in this class.
    Parameters:
      `name` - the name of the field of interest
    Returns:
      the method matching the given name and parameters or null

  - ### getField

    public FieldNode getField(String name)
    Finds a field matching the given name in this class or a parent class.
    Parameters:
      `name` - the name of the field of interest
    Returns:
      the method matching the given name and parameters or null

  - ### getObjectInitializerStatements

    public List<Statement> getObjectInitializerStatements()

  - ### getDeclaredMethods

    public List<MethodNode> getDeclaredMethods(String name)
    Returns a list of all methods with the given name from this class.
    Returns:
      method list (possibly empty)
    See Also:
      - `getMethods(String)`

  - ### getMethods

    public List<MethodNode> getMethods(String name)
    Returns a list of all methods with the given name from this class and its super class(es).
    Returns:
      method list (possibly empty)
    See Also:
      - `getDeclaredMethods(String)`

  - ### getDeclaredMethod

    public MethodNode getDeclaredMethod(String name, Parameter[] parameters)
    Finds a method matching the given name and parameters in this class.
    Returns:
      method node or null

  - ### getMethod

    public MethodNode getMethod(String name, Parameter[] parameters)
    Finds a method matching the given name and parameters in this class or any super class.
    Returns:
      method node or null

  - ### isDerivedFrom

    public boolean isDerivedFrom(ClassNode type)
    Parameters:
      `type` - the ClassNode of interest
    Returns:
      true if this node is derived from the given ClassNode

  - ### isDerivedFromGroovyObject

    public boolean isDerivedFromGroovyObject()
    Returns:
      `true` if this type implements `GroovyObject`

  - ### implementsAnyInterfaces

    public boolean implementsAnyInterfaces(ClassNode... classNodes)
    Parameters:
      `classNodes` - the class nodes for the interfaces
    Returns:
      `true` if this type implements any of the given interfaces

  - ### implementsInterface

    public boolean implementsInterface(ClassNode classNode)
    Parameters:
      `classNode` - the class node for the interface
    Returns:
      `true` if this type implements the given interface

  - ### declaresAnyInterfaces

    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

  - ### declaresInterface

    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(org.codehaus.groovy.ast.ClassNode, org.codehaus.groovy.ast.ClassNode)`

  - ### parametersEqual

    @Deprecated(forRemoval=true, since="4.0.0") protected boolean parametersEqual(Parameter[] a, Parameter[] b)
    Deprecated, for removal: This API element is subject to removal in a future version.

  - ### getGetterMethod

    public MethodNode getGetterMethod(String getterName)

  - ### getGetterMethod

    public MethodNode getGetterMethod(String getterName, boolean searchSupers)

  - ### getSetterMethod

    public MethodNode getSetterMethod(String setterName)

  - ### getSetterMethod

    public MethodNode getSetterMethod(String setterName, boolean voidOnly)

  - ### hasPossibleMethod

    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

  - ### tryFindPossibleMethod

    public MethodNode tryFindPossibleMethod(String name, Expression arguments)

  - ### hasPossibleStaticMethod

    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

  - ### renameField

    public void renameField(String oldName, String newName)

  - ### removeField

    public void removeField(String oldName)

  - ### removeMethod

    public void removeMethod(MethodNode node)

  - ### removeConstructor

    public void removeConstructor(ConstructorNode node)

  - ### equals

    public boolean equals(Object that)
    Overrides:
      `equals` in class `Object`

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Object`

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### toString

    public String toString(boolean showRedirect)

  - ### visitContents

    public void visitContents(GroovyClassVisitor visitor)

  - ### isAbstract

    public boolean isAbstract()

  - ### isInterface

    public boolean isInterface()

  - ### isAnnotationDefinition

    public boolean isAnnotationDefinition()

  - ### isEnum

    public boolean isEnum()

  - ### isRecord

    @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

  - ### isSealed

    @Incubating public boolean isSealed()
    Returns:
      `true` for native and emulated (annotation based) sealed classes
    Since:
      4.0.0

  - ### isResolved

    public boolean isResolved()

  - ### getTypeClass

    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.

  - ### isArray

    public boolean isArray()

  - ### makeArray

    public ClassNode makeArray()
    Returns a `ClassNode` representing an array of the type represented by this.

  - ### getComponentType

    public ClassNode getComponentType()

  - ### getOuterClass

    public ClassNode getOuterClass()

  - ### getOuterClasses

    public List<ClassNode> getOuterClasses()

  - ### getOuterField

    public FieldNode getOuterField(String name)
    Returns:
      the field on the outer class or `null` if this is not an inner class

  - ### getInnerClasses

    public Iterator<InnerClassNode> getInnerClasses()
    Returns:
      iterator of inner classes defined inside this one

  - ### getEnclosingMethod

    public MethodNode getEnclosingMethod()
    The enclosing method of local inner class.

  - ### setEnclosingMethod

    public void setEnclosingMethod(MethodNode enclosingMethod)

  - ### asGenericsType

    public GenericsType asGenericsType()

  - ### getGenericsTypes

    public GenericsType[] getGenericsTypes()

  - ### setGenericsTypes

    public void setGenericsTypes(GenericsType[] genericsTypes)

  - ### isGenericsPlaceHolder

    public boolean isGenericsPlaceHolder()

  - ### setGenericsPlaceHolder

    public void setGenericsPlaceHolder(boolean placeholder)

  - ### isUsingGenerics

    public boolean isUsingGenerics()

  - ### setUsingGenerics

    public void setUsingGenerics(boolean usesGenerics)

  - ### isScript

    public boolean isScript()

  - ### setScript

    public void setScript(boolean script)

  - ### isScriptBody

    public boolean isScriptBody()
    Returns:
      `true` if this inner class or closure was declared inside a script body

  - ### setScriptBody

    public void setScriptBody(boolean scriptBody)

  - ### isStaticClass

    public boolean isStaticClass()
    Is this class declared in a static method (such as a closure / inner class declared in a static method)

  - ### setStaticClass

    public void setStaticClass(boolean staticClass)

  - ### isSyntheticPublic

    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

  - ### setSyntheticPublic

    public void setSyntheticPublic(boolean syntheticPublic)

  - ### isAnnotated

    public boolean isAnnotated()

  - ### setAnnotated

    public void setAnnotated(boolean annotated)

  - ### getAnnotations

    public List<AnnotationNode> getAnnotations()
    Overrides:
      `getAnnotations` in class `AnnotatedNode`

  - ### getAnnotations

    public List<AnnotationNode> getAnnotations(ClassNode type)
    Overrides:
      `getAnnotations` in class `AnnotatedNode`

  - ### getTypeAnnotations

    public List<AnnotationNode> getTypeAnnotations()

  - ### getTypeAnnotations

    public List<AnnotationNode> getTypeAnnotations(ClassNode type)

  - ### addTypeAnnotation

    public void addTypeAnnotation(AnnotationNode annotation)

  - ### addTypeAnnotations

    public void addTypeAnnotations(List<AnnotationNode> annotations)

  - ### addTransform

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

  - ### getTransforms

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