Package org.codehaus.groovy.classgen

# Class AsmClassGenerator

java.lang.Object
org.codehaus.groovy.ast.CodeVisitorSupport
org.codehaus.groovy.ast.ClassCodeVisitorSupport
org.codehaus.groovy.classgen.ClassGenerator
org.codehaus.groovy.classgen.AsmClassGenerator

All Implemented Interfaces:
  `GroovyClassVisitor`, `GroovyCodeVisitor`, `ErrorCollecting`

public class AsmClassGenerator extends ClassGenerator
Generates Java class versions of Groovy classes using ASM.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final boolean`
  `ASM_DEBUG`
  Add marker in the bytecode to show source-bytecode relationship.
  `static final boolean`
  `CREATE_DEBUG_INFO`
  Enables emission of local-variable and source debug metadata.
  `static final boolean`
  `CREATE_LINE_NUMBER_INFO`
  Enables emission of line number tables.
  `static final String`
  `ELIDE_EXPRESSION_VALUE`
  Metadata key used to mark expressions whose value should be discarded.
  `static final MethodCallerMultiAdapter`
  `getField`
  Runtime helper used for dynamic field reads.
  `static final MethodCallerMultiAdapter`
  `getGroovyObjectField`
  Runtime helper used for dynamic field reads against `GroovyObject` receivers.
  `static final String`
  `MINIMUM_BYTECODE_VERSION`
  Metadata key used to request a minimum emitted bytecode level.
  `static final MethodCallerMultiAdapter`
  `setField`
  Runtime helper used for dynamic field writes.
  `static final MethodCallerMultiAdapter`
  `setGroovyObjectField`
  Runtime helper used for dynamic field writes against `GroovyObject` receivers.
  `static final MethodCallerMultiAdapter`
  `setProperty`
  Runtime helper used for dynamic property writes.

  ### Fields inherited from class org.codehaus.groovy.classgen.ClassGenerator

  `innerClasses`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AsmClassGenerator(SourceUnit source, GeneratorContext context, org.objectweb.asm.ClassVisitor classVisitor, String sourceFile)`
  Creates a bytecode generator for a single class.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `addInnerClass(ClassNode innerClass)`
  Registers a generated inner class with the enclosing module.
  `static int`
  `argumentSize(Expression arguments)`
  Calculates the argument count represented by an argument expression.
  `static boolean`
  `containsSpreadExpression(Expression expression)`
  Determines whether the supplied argument or collection expression contains a spread element.
  `protected void`
  `createInterfaceSyntheticStaticFields()`
  Creates helper class literal fields for interface bytecode generation.
  `protected void`
  `createSyntheticStaticFields()`
  Creates synthetic class-literal helper fields and accessors on the current class.
  `void`
  `despreadList(List<Expression> expressions, boolean wrap)`
  Expands spread arguments into the runtime list representation expected by call sites.
  `WriterController`
  `getController()`
  Returns the writer controller coordinating bytecode emission.
  `static FieldNode`
  `getDeclaredFieldOfCurrentClassOrAccessibleFieldOfSuper(ClassNode accessingNode, ClassNode current, String fieldName, boolean skipCurrent)`
  Resolves a field declared on the current class or an accessible superclass.
  `SourceUnit`
  `getSourceUnit()`
  Provides access to the `SourceUnit` for error reporting during visitation.
  `static boolean`
  `isFieldDirectlyAccessible(FieldNode field, ClassNode accessingClass)`
  Determines if the given field can be directly accessed by the given class (via `GETFIELD`, `GETSTATIC`, etc.
  `static boolean`
  `isMemberDirectlyAccessible(int modifiers, ClassNode declaringClass, ClassNode accessingClass)`
  Determines whether a member with the supplied modifiers is directly accessible to a class.
  `void`
  `loadInstanceField(FieldExpression expression)`
  RHS instance field.
  `void`
  `loadStaticField(FieldExpression expression)`
  Loads a static field value onto the operand stack.
  `void`
  `loadWrapper(Expression expression)`
  Wraps the top-of-stack value for reflective invocation helper paths.
  `void`
  `onLineNumber(ASTNode node, String message)`
  Emits line number information for the supplied node when appropriate.
  `void`
  `throwException(String message)`
  Throws a parser exception associated with the current AST node.
  `void`
  `visitAnnotationAttributes(AnnotationNode an, org.objectweb.asm.AnnotationVisitor av)`
  Generates the annotation attributes.
  `void`
  `visitAnnotations(AnnotatedNode node)`
  Visits annotations on an `AnnotatedNode`, delegating to `ClassCodeVisitorSupport.visitAnnotation(AnnotationNode)`.
  `void`
  `visitArgumentlistExpression(ArgumentListExpression ale)`
  Visits an `ArgumentListExpression`, treating it as a tuple expression.
  `void`
  `visitArrayExpression(ArrayExpression expression)`
  Visits an `ArrayExpression`, traversing element expressions and size expressions.
  `void`
  `visitAssertStatement(AssertStatement statement)`
  Visits an `AssertStatement`, invoking the statement hook before parent traversal.
  `void`
  `visitAttributeExpression(AttributeExpression expression)`
  Visits an `AttributeExpression`, traversing the object and attribute name expressions.
  `void`
  `visitBinaryExpression(BinaryExpression expression)`
  Visits a `BinaryExpression`, traversing left and right operand expressions.
  `void`
  `visitBitwiseNegationExpression(BitwiseNegationExpression expression)`
  Visits a `BitwiseNegationExpression`, traversing the operand expression.
  `void`
  `visitBlockStatement(BlockStatement statement)`
  Visits a `BlockStatement`, invoking the statement hook before parent traversal.
  `void`
  `visitBooleanExpression(BooleanExpression expression)`
  Visits a `BooleanExpression`, traversing the contained expression.
  `void`
  `visitBreakStatement(BreakStatement statement)`
  Visits a `BreakStatement`, invoking the statement hook before parent traversal.
  `void`
  `visitBytecodeExpression(BytecodeExpression expression)`
  Visits a `BytecodeExpression`.
  `void`
  `visitBytecodeSequence(BytecodeSequence bytecodeSequence)`
  Visits a bytecode sequence during AST traversal.
  `void`
  `visitCaseStatement(CaseStatement statement)`
  Visits a `CaseStatement`, invoking the statement hook before parent traversal.
  `void`
  `visitCastExpression(CastExpression castExpression)`
  Visits a `CastExpression`, traversing the operand expression.
  `void`
  `visitCatchStatement(CatchStatement statement)`
  Visits a `CatchStatement`, processing variable annotations and invoking the statement hook.
  `void`
  `visitClass(ClassNode classNode)`
  Visits a `ClassNode`, processing its annotations, package, imports, contents, and object initializers.
  `void`
  `visitClassExpression(ClassExpression expression)`
  Visits a `ClassExpression`.
  `void`
  `visitClosureExpression(ClosureExpression expression)`
  Visits a `ClosureExpression` with annotation processing, traversing parameter annotations before delegating to parent traversal.
  `void`
  `visitClosureListExpression(ClosureListExpression expression)`
  Visits a `ClosureListExpression`, traversing all contained expressions.
  `void`
  `visitConstantExpression(ConstantExpression expression)`
  Generates byte code for constants.
  `void`
  `visitConstructor(ConstructorNode node)`
  Visits a `ConstructorNode`, processing its annotations, parameter annotations, and code block.
  `void`
  `visitConstructorCallExpression(ConstructorCallExpression call)`
  Visits a `ConstructorCallExpression`, traversing its argument list.
  `protected void`
  `visitConstructorOrMethod(MethodNode node, boolean isConstructor)`
  Visits a constructor or method node (implementation detail for both visit methods).
  `void`
  `visitContinueStatement(ContinueStatement statement)`
  Visits a `ContinueStatement`, invoking the statement hook before parent traversal.
  `void`
  `visitDeclarationExpression(DeclarationExpression expression)`
  Visits a `DeclarationExpression` with annotation processing, traversing expression annotations before delegating to parent traversal.
  `void`
  `visitDoWhileLoop(DoWhileStatement statement)`
  Visits a `DoWhileStatement`, invoking statement hooks before parent traversal.
  `void`
  `visitExpressionStatement(ExpressionStatement statement)`
  Visits an `ExpressionStatement`, invoking the statement hook before parent traversal.
  `void`
  `visitField(FieldNode fieldNode)`
  Visits a `FieldNode`, processing its annotations and initial value expression if present.
  `void`
  `visitFieldExpression(FieldExpression expression)`
  Visits a `FieldExpression`.
  `void`
  `visitForLoop(ForStatement statement)`
  Visits a `ForStatement`, invoking statement hooks and processing loop variable annotations.
  `void`
  `visitGStringExpression(GStringExpression expression)`
  Visits a `GStringExpression`, traversing string parts and interpolated value expressions.
  `void`
  `visitIfElse(IfStatement statement)`
  Visits an `IfStatement`, invoking the statement hook before parent traversal.
  `void`
  `visitLambdaExpression(LambdaExpression expression)`
  Visits a `LambdaExpression`, treating it as a closure expression.
  `void`
  `visitListExpression(ListExpression expression)`
  Visits a `ListExpression`, traversing all contained expressions.
  `void`
  `visitMapEntryExpression(MapEntryExpression expression)`
  Visits a `MapEntryExpression`, traversing key and value expressions.
  `void`
  `visitMapExpression(MapExpression expression)`
  Visits a `MapExpression`, traversing all map entry expressions.
  `void`
  `visitMethod(MethodNode node)`
  Visits a `MethodNode`, processing its annotations, parameter annotations, and code block.
  `void`
  `visitMethodCallExpression(MethodCallExpression call)`
  Visits a `MethodCallExpression`, traversing the object expression, method expression, and argument list.
  `void`
  `visitMethodPointerExpression(MethodPointerExpression expression)`
  Visits a `MethodPointerExpression`, traversing the object and method name expressions.
  `void`
  `visitMethodReferenceExpression(MethodReferenceExpression expression)`
  Visits a `MethodReferenceExpression`, treating it as a method pointer.
  `void`
  `visitNotExpression(NotExpression expression)`
  Visits a `NotExpression`, traversing the operand expression.
  `void`
  `visitPostfixExpression(PostfixExpression expression)`
  Visits a `PostfixExpression`, traversing the operand expression.
  `void`
  `visitPrefixExpression(PrefixExpression expression)`
  Visits a `PrefixExpression`, traversing the operand expression.
  `void`
  `visitProperty(PropertyNode statement)`
  Visits a `PropertyNode`, processing its annotations, initial value expression, and getter/setter blocks if present.
  `void`
  `visitPropertyExpression(PropertyExpression expression)`
  Visits a `PropertyExpression`, traversing the object and property name expressions.
  `void`
  `visitRangeExpression(RangeExpression expression)`
  Visits a `RangeExpression`, traversing from and to boundary expressions.
  `void`
  `visitReturnStatement(ReturnStatement statement)`
  Visits a `ReturnStatement`, invoking the statement hook before parent traversal.
  `void`
  `visitSpreadExpression(SpreadExpression expression)`
  Visits a `SpreadExpression`, traversing the operand expression.
  `void`
  `visitSpreadMapExpression(SpreadMapExpression expression)`
  Visits a `SpreadMapExpression`, traversing the operand expression.
  `protected void`
  `visitStatement(Statement statement)`
  Hook method called when visiting any `Statement`.
  `void`
  `visitStaticMethodCallExpression(StaticMethodCallExpression call)`
  Visits a `StaticMethodCallExpression`, traversing its argument list.
  `void`
  `visitSwitch(SwitchStatement statement)`
  Visits a `SwitchStatement`, invoking the statement hook before parent traversal.
  `void`
  `visitSynchronizedStatement(SynchronizedStatement statement)`
  Visits a `SynchronizedStatement`, invoking the statement hook before parent traversal.
  `void`
  `visitTernaryExpression(TernaryExpression expression)`
  Visits a `TernaryExpression`, traversing the condition, true-branch, and false-branch expressions.
  `void`
  `visitThrowStatement(ThrowStatement statement)`
  Visits a `ThrowStatement`, invoking the statement hook before parent traversal.
  `void`
  `visitTryCatchFinally(TryCatchStatement statement)`
  Visits a `TryCatchStatement`, invoking the statement hook before parent traversal.
  `void`
  `visitTupleExpression(TupleExpression expression)`
  Visits a `TupleExpression`, traversing all contained expressions.
  `void`
  `visitUnaryMinusExpression(UnaryMinusExpression expression)`
  Visits a `UnaryMinusExpression`, traversing the operand expression.
  `void`
  `visitUnaryPlusExpression(UnaryPlusExpression expression)`
  Visits a `UnaryPlusExpression`, traversing the operand expression.
  `void`
  `visitVariableExpression(VariableExpression expression)`
  Visits a `VariableExpression`.
  `void`
  `visitWhileLoop(WhileStatement statement)`
  Visits a `WhileStatement`, invoking statement hooks before parent traversal.

  ### Methods inherited from class org.codehaus.groovy.classgen.ClassGenerator

  `getInnerClasses`

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

  `addError, visitAnnotation, visitAnnotations, visitClassCodeContainer, visitImports, visitObjectInitializerStatements, visitPackage, visitStatementAnnotations`

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

  `afterSwitchCaseStatementsVisited, afterSwitchConditionExpressionVisited, visitEmptyStatement, visitShortTernaryExpression`

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

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

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

  `visit, visit, visitEmptyExpression, visitListOfExpressions`

- ## Field Details

  - ### setField

    public static final MethodCallerMultiAdapter setField
    Runtime helper used for dynamic field writes.

  - ### getField

    public static final MethodCallerMultiAdapter getField
    Runtime helper used for dynamic field reads.

  - ### setGroovyObjectField

    public static final MethodCallerMultiAdapter setGroovyObjectField
    Runtime helper used for dynamic field writes against `GroovyObject` receivers.

  - ### getGroovyObjectField

    public static final MethodCallerMultiAdapter getGroovyObjectField
    Runtime helper used for dynamic field reads against `GroovyObject` receivers.

  - ### setProperty

    public static final MethodCallerMultiAdapter setProperty
    Runtime helper used for dynamic property writes.

  - ### ASM_DEBUG

    public static final boolean ASM_DEBUG
    Add marker in the bytecode to show source-bytecode relationship.
    See Also:
      - Constant Field Values

  - ### CREATE_DEBUG_INFO

    public static final boolean CREATE_DEBUG_INFO
    Enables emission of local-variable and source debug metadata.
    See Also:
      - Constant Field Values

  - ### CREATE_LINE_NUMBER_INFO

    public static final boolean CREATE_LINE_NUMBER_INFO
    Enables emission of line number tables.
    See Also:
      - Constant Field Values

  - ### ELIDE_EXPRESSION_VALUE

    public static final String ELIDE_EXPRESSION_VALUE
    Metadata key used to mark expressions whose value should be discarded.
    See Also:
      - Constant Field Values

  - ### MINIMUM_BYTECODE_VERSION

    public static final String MINIMUM_BYTECODE_VERSION
    Metadata key used to request a minimum emitted bytecode level.
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### AsmClassGenerator

    public AsmClassGenerator(SourceUnit source, GeneratorContext context, org.objectweb.asm.ClassVisitor classVisitor, String sourceFile)
    Creates a bytecode generator for a single class.
    Parameters:
      `source` - the source unit being compiled
      `context` - shared generation state for the enclosing compile unit
      `classVisitor` - the ASM visitor receiving the emitted class
      `sourceFile` - the source file name recorded in the generated class

- ## Method Details

  - ### getSourceUnit

    public SourceUnit getSourceUnit()
    Provides access to the `SourceUnit` for error reporting during visitation. Implementations must override this method.
    Overrides:
      `getSourceUnit` in class `ClassGenerator`
    Returns:
      the source unit for this visitor

  - ### getController

    public WriterController getController()
    Returns the writer controller coordinating bytecode emission.
    Returns:
      the active writer controller

  - ### visitClass

    public void visitClass(ClassNode classNode)
    Visits a `ClassNode`, processing its annotations, package, imports, contents, and object initializers.
    Specified by:
      `visitClass` in interface `GroovyClassVisitor`
    Overrides:
      `visitClass` in class `ClassCodeVisitorSupport`
    Parameters:
      `classNode` - the class node to visit

  - ### visitConstructorOrMethod

    protected void visitConstructorOrMethod(MethodNode node, boolean isConstructor)
    Visits a constructor or method node (implementation detail for both visit methods). Processes the node's annotations, all parameter annotations, and code block.
    Overrides:
      `visitConstructorOrMethod` in class `ClassCodeVisitorSupport`
    Parameters:
      `node` - the method or constructor node
      `isConstructor` - true if node is a constructor, false if it is a method

  - ### visitConstructor

    public void visitConstructor(ConstructorNode node)
    Visits a `ConstructorNode`, processing its annotations, parameter annotations, and code block.
    Specified by:
      `visitConstructor` in interface `GroovyClassVisitor`
    Overrides:
      `visitConstructor` in class `ClassCodeVisitorSupport`
    Parameters:
      `node` - the constructor node to visit

  - ### visitMethod

    public void visitMethod(MethodNode node)
    Visits a `MethodNode`, processing its annotations, parameter annotations, and code block.
    Specified by:
      `visitMethod` in interface `GroovyClassVisitor`
    Overrides:
      `visitMethod` in class `ClassCodeVisitorSupport`
    Parameters:
      `node` - the method node to visit

  - ### visitField

    public void visitField(FieldNode fieldNode)
    Visits a `FieldNode`, processing its annotations and initial value expression if present.
    Specified by:
      `visitField` in interface `GroovyClassVisitor`
    Overrides:
      `visitField` in class `ClassCodeVisitorSupport`
    Parameters:
      `fieldNode` - the field node to visit

  - ### visitProperty

    public void visitProperty(PropertyNode statement)
    Visits a `PropertyNode`, processing its annotations, initial value expression, and getter/setter blocks if present.
    Specified by:
      `visitProperty` in interface `GroovyClassVisitor`
    Overrides:
      `visitProperty` in class `ClassCodeVisitorSupport`
    Parameters:
      `statement` - the property node to visit

  - ### visitStatement

    protected void visitStatement(Statement statement)
    Hook method called when visiting any `Statement`. Subclasses may override to perform common processing on all statements.
    Overrides:
      `visitStatement` in class `ClassCodeVisitorSupport`
    Parameters:
      `statement` - the statement being visited

  - ### visitBlockStatement

    public void visitBlockStatement(BlockStatement statement)
    Visits a `BlockStatement`, invoking the statement hook before parent traversal.
    Specified by:
      `visitBlockStatement` in interface `GroovyCodeVisitor`
    Overrides:
      `visitBlockStatement` in class `ClassCodeVisitorSupport`
    Parameters:
      `statement` - the block statement to visit
    See Also:
      - `CodeVisitorSupport.visitForLoop(ForStatement)`
      - `CodeVisitorSupport.visitWhileLoop(WhileStatement)`

  - ### visitForLoop

    public void visitForLoop(ForStatement statement)
    Visits a `ForStatement`, invoking statement hooks and processing loop variable annotations.
    Specified by:
      `visitForLoop` in interface `GroovyCodeVisitor`
    Overrides:
      `visitForLoop` in class `ClassCodeVisitorSupport`
    Parameters:
      `statement` - the for statement to visit

  - ### visitWhileLoop

    public void visitWhileLoop(WhileStatement statement)
    Visits a `WhileStatement`, invoking statement hooks before parent traversal.
    Specified by:
      `visitWhileLoop` in interface `GroovyCodeVisitor`
    Overrides:
      `visitWhileLoop` in class `ClassCodeVisitorSupport`
    Parameters:
      `statement` - the while statement to visit

  - ### visitDoWhileLoop

    public void visitDoWhileLoop(DoWhileStatement statement)
    Visits a `DoWhileStatement`, invoking statement hooks before parent traversal.
    Specified by:
      `visitDoWhileLoop` in interface `GroovyCodeVisitor`
    Overrides:
      `visitDoWhileLoop` in class `ClassCodeVisitorSupport`
    Parameters:
      `statement` - the do-while statement to visit

  - ### visitIfElse

    public void visitIfElse(IfStatement statement)
    Visits an `IfStatement`, invoking the statement hook before parent traversal.
    Specified by:
      `visitIfElse` in interface `GroovyCodeVisitor`
    Overrides:
      `visitIfElse` in class `ClassCodeVisitorSupport`
    Parameters:
      `statement` - the if statement to visit

  - ### visitAssertStatement

    public void visitAssertStatement(AssertStatement statement)
    Visits an `AssertStatement`, invoking the statement hook before parent traversal.
    Specified by:
      `visitAssertStatement` in interface `GroovyCodeVisitor`
    Overrides:
      `visitAssertStatement` in class `ClassCodeVisitorSupport`
    Parameters:
      `statement` - the assert statement to visit

  - ### visitTryCatchFinally

    public void visitTryCatchFinally(TryCatchStatement statement)
    Visits a `TryCatchStatement`, invoking the statement hook before parent traversal.
    Specified by:
      `visitTryCatchFinally` in interface `GroovyCodeVisitor`
    Overrides:
      `visitTryCatchFinally` in class `ClassCodeVisitorSupport`
    Parameters:
      `statement` - the try-catch statement to visit

  - ### visitCatchStatement

    public void visitCatchStatement(CatchStatement statement)
    Visits a `CatchStatement`, processing variable annotations and invoking the statement hook.
    Specified by:
      `visitCatchStatement` in interface `GroovyCodeVisitor`
    Overrides:
      `visitCatchStatement` in class `ClassCodeVisitorSupport`
    Parameters:
      `statement` - the catch statement to visit

  - ### visitSwitch

    public void visitSwitch(SwitchStatement statement)
    Visits a `SwitchStatement`, invoking the statement hook before parent traversal.
    Specified by:
      `visitSwitch` in interface `GroovyCodeVisitor`
    Overrides:
      `visitSwitch` in class `ClassCodeVisitorSupport`
    Parameters:
      `statement` - the switch statement to visit

  - ### visitCaseStatement

    public void visitCaseStatement(CaseStatement statement)
    Visits a `CaseStatement`, invoking the statement hook before parent traversal.
    Specified by:
      `visitCaseStatement` in interface `GroovyCodeVisitor`
    Overrides:
      `visitCaseStatement` in class `ClassCodeVisitorSupport`
    Parameters:
      `statement` - the case statement to visit

  - ### visitBreakStatement

    public void visitBreakStatement(BreakStatement statement)
    Visits a `BreakStatement`, invoking the statement hook before parent traversal.
    Specified by:
      `visitBreakStatement` in interface `GroovyCodeVisitor`
    Overrides:
      `visitBreakStatement` in class `ClassCodeVisitorSupport`
    Parameters:
      `statement` - the break statement to visit

  - ### visitContinueStatement

    public void visitContinueStatement(ContinueStatement statement)
    Visits a `ContinueStatement`, invoking the statement hook before parent traversal.
    Specified by:
      `visitContinueStatement` in interface `GroovyCodeVisitor`
    Overrides:
      `visitContinueStatement` in class `ClassCodeVisitorSupport`
    Parameters:
      `statement` - the continue statement to visit

  - ### visitSynchronizedStatement

    public void visitSynchronizedStatement(SynchronizedStatement statement)
    Visits a `SynchronizedStatement`, invoking the statement hook before parent traversal.
    Specified by:
      `visitSynchronizedStatement` in interface `GroovyCodeVisitor`
    Overrides:
      `visitSynchronizedStatement` in class `ClassCodeVisitorSupport`
    Parameters:
      `statement` - the synchronized statement to visit

  - ### visitThrowStatement

    public void visitThrowStatement(ThrowStatement statement)
    Visits a `ThrowStatement`, invoking the statement hook before parent traversal.
    Specified by:
      `visitThrowStatement` in interface `GroovyCodeVisitor`
    Overrides:
      `visitThrowStatement` in class `ClassCodeVisitorSupport`
    Parameters:
      `statement` - the throw statement to visit

  - ### visitReturnStatement

    public void visitReturnStatement(ReturnStatement statement)
    Visits a `ReturnStatement`, invoking the statement hook before parent traversal.
    Specified by:
      `visitReturnStatement` in interface `GroovyCodeVisitor`
    Overrides:
      `visitReturnStatement` in class `ClassCodeVisitorSupport`
    Parameters:
      `statement` - the return statement to visit

  - ### visitExpressionStatement

    public void visitExpressionStatement(ExpressionStatement statement)
    Visits an `ExpressionStatement`, invoking the statement hook before parent traversal.
    Specified by:
      `visitExpressionStatement` in interface `GroovyCodeVisitor`
    Overrides:
      `visitExpressionStatement` in class `ClassCodeVisitorSupport`
    Parameters:
      `statement` - the expression statement to visit

  - ### visitTernaryExpression

    public void visitTernaryExpression(TernaryExpression expression)
    Visits a `TernaryExpression`, traversing the condition, true-branch, and false-branch expressions.
    Specified by:
      `visitTernaryExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitTernaryExpression` in class `CodeVisitorSupport`
    Parameters:
      `expression` - the ternary expression

  - ### visitDeclarationExpression

    public void visitDeclarationExpression(DeclarationExpression expression)
    Visits a `DeclarationExpression` with annotation processing, traversing expression annotations before delegating to parent traversal.
    Specified by:
      `visitDeclarationExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitDeclarationExpression` in class `ClassCodeVisitorSupport`
    Parameters:
      `expression` - the declaration expression to visit

  - ### visitBinaryExpression

    public void visitBinaryExpression(BinaryExpression expression)
    Visits a `BinaryExpression`, traversing left and right operand expressions.
    Specified by:
      `visitBinaryExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitBinaryExpression` in class `CodeVisitorSupport`
    Parameters:
      `expression` - the binary expression

  - ### visitPostfixExpression

    public void visitPostfixExpression(PostfixExpression expression)
    Visits a `PostfixExpression`, traversing the operand expression.
    Specified by:
      `visitPostfixExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitPostfixExpression` in class `CodeVisitorSupport`
    Parameters:
      `expression` - the postfix expression

  - ### visitPrefixExpression

    public void visitPrefixExpression(PrefixExpression expression)
    Visits a `PrefixExpression`, traversing the operand expression.
    Specified by:
      `visitPrefixExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitPrefixExpression` in class `CodeVisitorSupport`
    Parameters:
      `expression` - the prefix expression

  - ### visitClosureExpression

    public void visitClosureExpression(ClosureExpression expression)
    Visits a `ClosureExpression` with annotation processing, traversing parameter annotations before delegating to parent traversal.
    Specified by:
      `visitClosureExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitClosureExpression` in class `ClassCodeVisitorSupport`
    Parameters:
      `expression` - the closure expression to visit

  - ### visitLambdaExpression

    public void visitLambdaExpression(LambdaExpression expression)
    Visits a `LambdaExpression`, treating it as a closure expression.
    Specified by:
      `visitLambdaExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitLambdaExpression` in class `CodeVisitorSupport`
    Parameters:
      `expression` - the lambda expression

  - ### visitConstantExpression

    public void visitConstantExpression(ConstantExpression expression)
    Generates byte code for constants.
    Specified by:
      `visitConstantExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitConstantExpression` in class `CodeVisitorSupport`
    Parameters:
      `expression` - the constant expression
    See Also:
      - Class field types

  - ### visitSpreadExpression

    public void visitSpreadExpression(SpreadExpression expression)
    Visits a `SpreadExpression`, traversing the operand expression.
    Specified by:
      `visitSpreadExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitSpreadExpression` in class `CodeVisitorSupport`
    Parameters:
      `expression` - the spread expression

  - ### visitSpreadMapExpression

    public void visitSpreadMapExpression(SpreadMapExpression expression)
    Visits a `SpreadMapExpression`, traversing the operand expression.
    Specified by:
      `visitSpreadMapExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitSpreadMapExpression` in class `CodeVisitorSupport`
    Parameters:
      `expression` - the spread map expression

  - ### visitMethodPointerExpression

    public void visitMethodPointerExpression(MethodPointerExpression expression)
    Visits a `MethodPointerExpression`, traversing the object and method name expressions.
    Specified by:
      `visitMethodPointerExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitMethodPointerExpression` in class `CodeVisitorSupport`
    Parameters:
      `expression` - the method pointer expression

  - ### visitMethodReferenceExpression

    public void visitMethodReferenceExpression(MethodReferenceExpression expression)
    Visits a `MethodReferenceExpression`, treating it as a method pointer.
    Specified by:
      `visitMethodReferenceExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitMethodReferenceExpression` in class `CodeVisitorSupport`
    Parameters:
      `expression` - the method reference expression

  - ### visitUnaryMinusExpression

    public void visitUnaryMinusExpression(UnaryMinusExpression expression)
    Visits a `UnaryMinusExpression`, traversing the operand expression.
    Specified by:
      `visitUnaryMinusExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitUnaryMinusExpression` in class `CodeVisitorSupport`
    Parameters:
      `expression` - the unary minus expression

  - ### visitUnaryPlusExpression

    public void visitUnaryPlusExpression(UnaryPlusExpression expression)
    Visits a `UnaryPlusExpression`, traversing the operand expression.
    Specified by:
      `visitUnaryPlusExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitUnaryPlusExpression` in class `CodeVisitorSupport`
    Parameters:
      `expression` - the unary plus expression

  - ### visitBitwiseNegationExpression

    public void visitBitwiseNegationExpression(BitwiseNegationExpression expression)
    Visits a `BitwiseNegationExpression`, traversing the operand expression.
    Specified by:
      `visitBitwiseNegationExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitBitwiseNegationExpression` in class `CodeVisitorSupport`
    Parameters:
      `expression` - the bitwise negation expression

  - ### visitCastExpression

    public void visitCastExpression(CastExpression castExpression)
    Visits a `CastExpression`, traversing the operand expression.
    Specified by:
      `visitCastExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitCastExpression` in class `CodeVisitorSupport`
    Parameters:
      `castExpression` - the cast expression

  - ### visitNotExpression

    public void visitNotExpression(NotExpression expression)
    Visits a `NotExpression`, traversing the operand expression.
    Specified by:
      `visitNotExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitNotExpression` in class `CodeVisitorSupport`
    Parameters:
      `expression` - the not expression

  - ### visitBooleanExpression

    public void visitBooleanExpression(BooleanExpression expression)
    Visits a `BooleanExpression`, traversing the contained expression.
    Specified by:
      `visitBooleanExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitBooleanExpression` in class `CodeVisitorSupport`
    Parameters:
      `expression` - the boolean expression

  - ### visitMethodCallExpression

    public void visitMethodCallExpression(MethodCallExpression call)
    Visits a `MethodCallExpression`, traversing the object expression, method expression, and argument list.
    Specified by:
      `visitMethodCallExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitMethodCallExpression` in class `CodeVisitorSupport`
    Parameters:
      `call` - the method call expression

  - ### visitStaticMethodCallExpression

    public void visitStaticMethodCallExpression(StaticMethodCallExpression call)
    Visits a `StaticMethodCallExpression`, traversing its argument list.
    Specified by:
      `visitStaticMethodCallExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitStaticMethodCallExpression` in class `CodeVisitorSupport`
    Parameters:
      `call` - the static method call expression

  - ### visitConstructorCallExpression

    public void visitConstructorCallExpression(ConstructorCallExpression call)
    Visits a `ConstructorCallExpression`, traversing its argument list.
    Specified by:
      `visitConstructorCallExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitConstructorCallExpression` in class `CodeVisitorSupport`
    Parameters:
      `call` - the constructor call expression

  - ### isFieldDirectlyAccessible

    public static boolean isFieldDirectlyAccessible(FieldNode field, ClassNode accessingClass)
    Determines if the given field can be directly accessed by the given class (via `GETFIELD`, `GETSTATIC`, etc. bytecode instructions).

  - ### isMemberDirectlyAccessible

    public static boolean isMemberDirectlyAccessible(int modifiers, ClassNode declaringClass, ClassNode accessingClass)
    Determines whether a member with the supplied modifiers is directly accessible to a class.
    Parameters:
      `modifiers` - the member modifiers
      `declaringClass` - the class declaring the member
      `accessingClass` - the class attempting access
    Returns:
      `true` if direct bytecode access is legal

  - ### getDeclaredFieldOfCurrentClassOrAccessibleFieldOfSuper

    public static FieldNode getDeclaredFieldOfCurrentClassOrAccessibleFieldOfSuper(ClassNode accessingNode, ClassNode current, String fieldName, boolean skipCurrent)
    Resolves a field declared on the current class or an accessible superclass.
    Parameters:
      `accessingNode` - the class performing the access
      `current` - the class whose hierarchy is being searched
      `fieldName` - the field name to resolve
      `skipCurrent` - whether to skip the current class and start with its superclass
    Returns:
      the resolved field, or `null` if none is directly accessible

  - ### visitPropertyExpression

    public void visitPropertyExpression(PropertyExpression expression)
    Visits a `PropertyExpression`, traversing the object and property name expressions.
    Specified by:
      `visitPropertyExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitPropertyExpression` in class `CodeVisitorSupport`
    Parameters:
      `expression` - the property expression

  - ### visitAttributeExpression

    public void visitAttributeExpression(AttributeExpression expression)
    Visits an `AttributeExpression`, traversing the object and attribute name expressions.
    Specified by:
      `visitAttributeExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitAttributeExpression` in class `CodeVisitorSupport`
    Parameters:
      `expression` - the attribute expression

  - ### visitFieldExpression

    public void visitFieldExpression(FieldExpression expression)
    Visits a `FieldExpression`. No traversal is performed as field expressions contain no child expressions.
    Specified by:
      `visitFieldExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitFieldExpression` in class `CodeVisitorSupport`
    Parameters:
      `expression` - the field expression

  - ### loadStaticField

    public void loadStaticField(FieldExpression expression)
    Loads a static field value onto the operand stack.
    Parameters:
      `expression` - the field expression to load

  - ### loadInstanceField

    public void loadInstanceField(FieldExpression expression)
    RHS instance field. should move most of the code in the BytecodeHelper

  - ### visitVariableExpression

    public void visitVariableExpression(VariableExpression expression)
    Visits a `VariableExpression`. No traversal is performed as variable expressions contain no child expressions.
    Specified by:
      `visitVariableExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitVariableExpression` in class `CodeVisitorSupport`
    Parameters:
      `expression` - the variable expression

  - ### createInterfaceSyntheticStaticFields

    protected void createInterfaceSyntheticStaticFields()
    Creates helper class literal fields for interface bytecode generation.

  - ### createSyntheticStaticFields

    protected void createSyntheticStaticFields()
    Creates synthetic class-literal helper fields and accessors on the current class.

  - ### visitClassExpression

    public void visitClassExpression(ClassExpression expression)
    Visits a `ClassExpression`. No traversal is performed as class expressions contain no child expressions.
    Specified by:
      `visitClassExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitClassExpression` in class `CodeVisitorSupport`
    Parameters:
      `expression` - the class expression

  - ### visitRangeExpression

    public void visitRangeExpression(RangeExpression expression)
    Visits a `RangeExpression`, traversing from and to boundary expressions.
    Specified by:
      `visitRangeExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitRangeExpression` in class `CodeVisitorSupport`
    Parameters:
      `expression` - the range expression

  - ### visitMapEntryExpression

    public void visitMapEntryExpression(MapEntryExpression expression)
    Visits a `MapEntryExpression`, traversing key and value expressions.
    Specified by:
      `visitMapEntryExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitMapEntryExpression` in class `CodeVisitorSupport`
    Parameters:
      `expression` - the map entry expression

  - ### visitMapExpression

    public void visitMapExpression(MapExpression expression)
    Visits a `MapExpression`, traversing all map entry expressions.
    Specified by:
      `visitMapExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitMapExpression` in class `CodeVisitorSupport`
    Parameters:
      `expression` - the map expression

  - ### visitArgumentlistExpression

    public void visitArgumentlistExpression(ArgumentListExpression ale)
    Visits an `ArgumentListExpression`, treating it as a tuple expression.
    Specified by:
      `visitArgumentlistExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitArgumentlistExpression` in class `CodeVisitorSupport`
    Parameters:
      `ale` - the argument list expression

  - ### visitTupleExpression

    public void visitTupleExpression(TupleExpression expression)
    Visits a `TupleExpression`, traversing all contained expressions.
    Specified by:
      `visitTupleExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitTupleExpression` in class `CodeVisitorSupport`
    Parameters:
      `expression` - the tuple expression

  - ### visitArrayExpression

    public void visitArrayExpression(ArrayExpression expression)
    Visits an `ArrayExpression`, traversing element expressions and size expressions.
    Specified by:
      `visitArrayExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitArrayExpression` in class `CodeVisitorSupport`
    Parameters:
      `expression` - the array expression

  - ### visitClosureListExpression

    public void visitClosureListExpression(ClosureListExpression expression)
    Visits a `ClosureListExpression`, traversing all contained expressions.
    Specified by:
      `visitClosureListExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitClosureListExpression` in class `CodeVisitorSupport`
    Parameters:
      `expression` - the closure list expression

  - ### visitBytecodeExpression

    public void visitBytecodeExpression(BytecodeExpression expression)
    Visits a `BytecodeExpression`. No traversal is performed as bytecode expressions are terminal.
    Specified by:
      `visitBytecodeExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitBytecodeExpression` in class `CodeVisitorSupport`
    Parameters:
      `expression` - the bytecode expression

  - ### visitBytecodeSequence

    public void visitBytecodeSequence(BytecodeSequence bytecodeSequence)
    Visits a bytecode sequence during AST traversal. Subclasses should override this method to handle custom bytecode generation.
    Overrides:
      `visitBytecodeSequence` in class `ClassGenerator`
    Parameters:
      `bytecodeSequence` - the bytecode sequence to visit

  - ### visitListExpression

    public void visitListExpression(ListExpression expression)
    Visits a `ListExpression`, traversing all contained expressions.
    Specified by:
      `visitListExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitListExpression` in class `CodeVisitorSupport`
    Parameters:
      `expression` - the list expression

  - ### visitGStringExpression

    public void visitGStringExpression(GStringExpression expression)
    Visits a `GStringExpression`, traversing string parts and interpolated value expressions.
    Specified by:
      `visitGStringExpression` in interface `GroovyCodeVisitor`
    Overrides:
      `visitGStringExpression` in class `CodeVisitorSupport`
    Parameters:
      `expression` - the GString expression

  - ### visitAnnotations

    public void visitAnnotations(AnnotatedNode node)
    Visits annotations on an `AnnotatedNode`, delegating to `ClassCodeVisitorSupport.visitAnnotation(AnnotationNode)`.
    Overrides:
      `visitAnnotations` in class `ClassCodeVisitorSupport`
    Parameters:
      `node` - the annotated node containing annotations to visit

  - ### visitAnnotationAttributes

    public void visitAnnotationAttributes(AnnotationNode an, org.objectweb.asm.AnnotationVisitor av)
    Generates the annotation attributes.
    Parameters:
      `an` - the node with an annotation
      `av` - the visitor to use

  - ### addInnerClass

    public boolean addInnerClass(ClassNode innerClass)
    Registers a generated inner class with the enclosing module.
    Parameters:
      `innerClass` - the inner class to register
    Returns:
      `true` if the inner class was queued for later emission

  - ### argumentSize

    public static int argumentSize(Expression arguments)
    Calculates the argument count represented by an argument expression.
    Parameters:
      `arguments` - the argument expression to inspect
    Returns:
      the represented argument count

  - ### containsSpreadExpression

    public static boolean containsSpreadExpression(Expression expression)
    Determines whether the supplied argument or collection expression contains a spread element.
    Parameters:
      `expression` - the expression to inspect
    Returns:
      `true` if any spread element is present

  - ### despreadList

    public void despreadList(List<Expression> expressions, boolean wrap)
    Expands spread arguments into the runtime list representation expected by call sites.
    Parameters:
      `expressions` - the argument expressions to expand
      `wrap` - whether certain arguments should be wrapped for constructor dispatch

  - ### loadWrapper

    public void loadWrapper(Expression expression)
    Wraps the top-of-stack value for reflective invocation helper paths.
    Parameters:
      `expression` - the expression whose runtime value should be wrapped

  - ### onLineNumber

    public void onLineNumber(ASTNode node, String message)
    Emits line number information for the supplied node when appropriate.
    Parameters:
      `node` - the current source node
      `message` - a debug message retained for compatibility with existing callers

  - ### throwException

    public void throwException(String message)
    Throws a parser exception associated with the current AST node.
    Parameters:
      `message` - the exception message