Package: org.codehaus.groovy.classgen

## [Java] Class AsmClassGenerator

- org.codehaus.groovy.classgen.AsmClassGenerator

-     public class AsmClassGenerator
      extends ClassGenerator

  Generates Java class versions of Groovy classes using ASM.

- - ### Field Summary

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

  - Inherited fields
    Fields inherited from class | Fields
    --- | ---
    `class ClassGenerator` | `innerClasses`

  - ### Constructor Summary

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

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public boolean` | `addInnerClass(ClassNode innerClass)` Registers a generated inner class with the enclosing module.
    `` | `public static int` | `argumentSize(Expression arguments)` Calculates the argument count represented by an argument expression.
    `` | `public 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.
    `` | `public void` | `despreadList(List<Expression> expressions, boolean wrap)` Expands spread arguments into the runtime list representation expected by call sites.
    `` | `public WriterController` | `getController()` Returns the writer controller coordinating bytecode emission.
    `` | `public static FieldNode` | `getDeclaredFieldOfCurrentClassOrAccessibleFieldOfSuper(ClassNode accessingNode, ClassNode current, String fieldName, boolean skipCurrent)` Resolves a field declared on the current class or an accessible superclass.
    `` | `public SourceUnit` | `getSourceUnit()` * * Provides access to the SourceUnit for error reporting during visitation. * Implementations must override this method. * * Returns: the source unit for this visitor
    `` | `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).
    `` | `public static boolean` | `isMemberDirectlyAccessible(int modifiers, ClassNode declaringClass, ClassNode accessingClass)` Determines whether a member with the supplied modifiers is directly accessible to a class.
    `` | `public void` | `loadInstanceField(FieldExpression expression)` RHS instance field. should move most of the code in the BytecodeHelper
    `` | `public void` | `loadStaticField(FieldExpression expression)` Loads a static field value onto the operand stack.
    `` | `public void` | `loadWrapper(Expression expression)` Wraps the top-of-stack value for reflective invocation helper paths.
    `` | `public void` | `onLineNumber(ASTNode node, String message)` Emits line number information for the supplied node when appropriate.
    `` | `public void` | `throwException(String message)` Throws a parser exception associated with the current AST node.
    `` | `public void` | `visitAnnotationAttributes(AnnotationNode an, AnnotationVisitor av)` Generates the annotation attributes.
    `` | `public void` | `visitAnnotations(AnnotatedNode node)` * Visits annotations on an AnnotatedNode, delegating to visitAnnotation(AnnotationNode). * * Parameters: `node` - the annotated node containing annotations to visit
    `` | `public void` | `visitArgumentlistExpression(ArgumentListExpression ale)` * Visits an ArgumentListExpression, treating it as a tuple expression. * * Parameters: `expression` - the argument list expression
    `` | `public void` | `visitArrayExpression(ArrayExpression expression)` * Visits an ArrayExpression, traversing element expressions and size expressions. * * Parameters: `expression` - the array expression
    `` | `public void` | `visitAssertStatement(AssertStatement statement)` * Visits an AssertStatement, invoking the statement hook before parent traversal. * * Parameters: `statement` - the assert statement to visit
    `` | `public void` | `visitAttributeExpression(AttributeExpression expression)` * Visits an AttributeExpression, traversing the object and attribute name expressions. * * Parameters: `expression` - the attribute expression
    `` | `public void` | `visitBinaryExpression(BinaryExpression expression)` * Visits a BinaryExpression, traversing left and right operand expressions. * * Parameters: `expression` - the binary expression
    `` | `public void` | `visitBitwiseNegationExpression(BitwiseNegationExpression expression)` * Visits a BitwiseNegationExpression, traversing the operand expression. * * Parameters: `expression` - the bitwise negation expression
    `` | `public void` | `visitBlockStatement(BlockStatement statement)` * Visits a BlockStatement, invoking the statement hook before parent traversal. * * Parameters: `statement` - the block statement to visit
    `` | `public void` | `visitBooleanExpression(BooleanExpression expression)` * Visits a BooleanExpression, traversing the contained expression. * * Parameters: `expression` - the boolean expression
    `` | `public void` | `visitBreakStatement(BreakStatement statement)` * Visits a BreakStatement, invoking the statement hook before parent traversal. * * Parameters: `statement` - the break statement to visit
    `` | `public void` | `visitBytecodeExpression(BytecodeExpression expression)` * Visits a BytecodeExpression. No traversal is performed as bytecode expressions are terminal. * * Parameters: `expression` - the bytecode expression
    `` | `public void` | `visitBytecodeSequence(BytecodeSequence bytecodeSequence)` * Visits a bytecode sequence during AST traversal. Subclasses should override * this method to handle custom bytecode generation. * * Parameters: `bytecodeSequence` - the bytecode sequence to visit
    `` | `public void` | `visitCaseStatement(CaseStatement statement)` * Visits a CaseStatement, invoking the statement hook before parent traversal. * * Parameters: `statement` - the case statement to visit
    `` | `public void` | `visitCastExpression(CastExpression castExpression)` * Visits a CastExpression, traversing the operand expression. * * Parameters: `expression` - the cast expression
    `` | `public void` | `visitCatchStatement(CatchStatement statement)` * Visits a CatchStatement, processing variable annotations and invoking the statement hook. * * Parameters: `statement` - the catch statement to visit
    `` | `public void` | `visitClass(ClassNode classNode)` * Visits a ClassNode, processing its annotations, package, imports, contents, and object initializers. * * Parameters: `node` - the class node to visit
    `` | `public void` | `visitClassExpression(ClassExpression expression)` * Visits a ClassExpression. No traversal is performed as class expressions contain no child expressions. * * Parameters: `expression` - the class expression
    `` | `public void` | `visitClosureExpression(ClosureExpression expression)` * Visits a ClosureExpression with annotation processing, traversing parameter annotations * before delegating to parent traversal. * * Parameters: `expression` - the closure expression to visit
    `` | `public void` | `visitClosureListExpression(ClosureListExpression expression)` * Visits a ClosureListExpression, traversing all contained expressions. * * Parameters: `expression` - the closure list expression
    `` | `public void` | `visitConstantExpression(ConstantExpression expression)` Generates byte code for constants.
    `` | `public void` | `visitConstructor(ConstructorNode node)` * Visits a ConstructorNode, processing its annotations, parameter annotations, and code block. * * Parameters: `node` - the constructor node to visit
    `` | `public void` | `visitConstructorCallExpression(ConstructorCallExpression call)` * Visits a ConstructorCallExpression, traversing its argument list. * * Parameters: `call` - the constructor call expression
    `` | `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. * * Parameters: `node` - the method or constructor node * `isConstructor` - true if node is a constructor, false if it is a method
    `` | `public void` | `visitContinueStatement(ContinueStatement statement)` * Visits a ContinueStatement, invoking the statement hook before parent traversal. * * Parameters: `statement` - the continue statement to visit
    `` | `public void` | `visitDeclarationExpression(DeclarationExpression expression)` * Visits a DeclarationExpression with annotation processing, traversing expression annotations * before delegating to parent traversal. * * Parameters: `expression` - the declaration expression to visit
    `` | `public void` | `visitDoWhileLoop(DoWhileStatement statement)` * Visits a DoWhileStatement, invoking statement hooks before parent traversal. * * Parameters: `statement` - the do-while statement to visit
    `` | `public void` | `visitExpressionStatement(ExpressionStatement statement)` * Visits an ExpressionStatement, invoking the statement hook before parent traversal. * * Parameters: `statement` - the expression statement to visit
    `` | `public void` | `visitField(FieldNode fieldNode)` * Visits a FieldNode, processing its annotations and initial value expression if present. * * Parameters: `node` - the field node to visit
    `` | `public void` | `visitFieldExpression(FieldExpression expression)` * Visits a FieldExpression. No traversal is performed as field expressions contain no child expressions. * * Parameters: `expression` - the field expression
    `` | `public void` | `visitForLoop(ForStatement statement)` * Visits a ForStatement, invoking statement hooks and processing loop variable annotations. * * Parameters: `statement` - the for statement to visit
    `` | `public void` | `visitGStringExpression(GStringExpression expression)` * Visits a GStringExpression, traversing string parts and interpolated value expressions. * * Parameters: `expression` - the GString expression
    `` | `public void` | `visitIfElse(IfStatement statement)` * Visits an IfStatement, invoking the statement hook before parent traversal. * * Parameters: `statement` - the if statement to visit
    `` | `public void` | `visitLambdaExpression(LambdaExpression expression)` * Visits a LambdaExpression, treating it as a closure expression. * * Parameters: `expression` - the lambda expression
    `` | `public void` | `visitListExpression(ListExpression expression)` * Visits a ListExpression, traversing all contained expressions. * * Parameters: `expression` - the list expression
    `` | `public void` | `visitMapEntryExpression(MapEntryExpression expression)` * Visits a MapEntryExpression, traversing key and value expressions. * * Parameters: `expression` - the map entry expression
    `` | `public void` | `visitMapExpression(MapExpression expression)` * Visits a MapExpression, traversing all map entry expressions. * * Parameters: `expression` - the map expression
    `` | `public void` | `visitMethod(MethodNode node)` * Visits a MethodNode, processing its annotations, parameter annotations, and code block. * * Parameters: `node` - the method node to visit
    `` | `public void` | `visitMethodCallExpression(MethodCallExpression call)` * Visits a MethodCallExpression, traversing the object expression, * method expression, and argument list. * * Parameters: `call` - the method call expression
    `` | `public void` | `visitMethodPointerExpression(MethodPointerExpression expression)` * Visits a MethodPointerExpression, traversing the object and method name expressions. * * Parameters: `expression` - the method pointer expression
    `` | `public void` | `visitMethodReferenceExpression(MethodReferenceExpression expression)` * Visits a MethodReferenceExpression, treating it as a method pointer. * * Parameters: `expression` - the method reference expression
    `` | `public void` | `visitNotExpression(NotExpression expression)` * Visits a NotExpression, traversing the operand expression. * * Parameters: `expression` - the not expression
    `` | `public void` | `visitPostfixExpression(PostfixExpression expression)` * Visits a PostfixExpression, traversing the operand expression. * * Parameters: `expression` - the postfix expression
    `` | `public void` | `visitPrefixExpression(PrefixExpression expression)` * Visits a PrefixExpression, traversing the operand expression. * * Parameters: `expression` - the prefix expression
    `` | `public void` | `visitProperty(PropertyNode statement)` * Visits a PropertyNode, processing its annotations, initial value expression, * and getter/setter blocks if present. * * Parameters: `node` - the property node to visit
    `` | `public void` | `visitPropertyExpression(PropertyExpression expression)` * Visits a PropertyExpression, traversing the object and property name expressions. * * Parameters: `expression` - the property expression
    `` | `public void` | `visitRangeExpression(RangeExpression expression)` * Visits a RangeExpression, traversing from and to boundary expressions. * * Parameters: `expression` - the range expression
    `` | `public void` | `visitReturnStatement(ReturnStatement statement)` * Visits a ReturnStatement, invoking the statement hook before parent traversal. * * Parameters: `statement` - the return statement to visit
    `` | `public void` | `visitSpreadExpression(SpreadExpression expression)` * Visits a SpreadExpression, traversing the operand expression. * * Parameters: `expression` - the spread expression
    `` | `public void` | `visitSpreadMapExpression(SpreadMapExpression expression)` * Visits a SpreadMapExpression, traversing the operand expression. * * Parameters: `expression` - the spread map expression
    `` | `protected void` | `visitStatement(Statement statement)` * Hook method called when visiting any Statement. Subclasses may override * to perform common processing on all statements. * * Parameters: `statement` - the statement being visited
    `` | `public void` | `visitStaticMethodCallExpression(StaticMethodCallExpression call)` * Visits a StaticMethodCallExpression, traversing its argument list. * * Parameters: `call` - the static method call expression
    `` | `public void` | `visitSwitch(SwitchStatement statement)` * Visits a SwitchStatement, invoking the statement hook before parent traversal. * * Parameters: `statement` - the switch statement to visit
    `` | `public void` | `visitSynchronizedStatement(SynchronizedStatement statement)` * Visits a SynchronizedStatement, invoking the statement hook before parent traversal. * * Parameters: `statement` - the synchronized statement to visit
    `` | `public void` | `visitTernaryExpression(TernaryExpression expression)` * Visits a TernaryExpression, traversing the condition, true-branch, and false-branch expressions. * * Parameters: `expression` - the ternary expression
    `` | `public void` | `visitThrowStatement(ThrowStatement statement)` * Visits a ThrowStatement, invoking the statement hook before parent traversal. * * Parameters: `statement` - the throw statement to visit
    `` | `public void` | `visitTryCatchFinally(TryCatchStatement statement)` * Visits a TryCatchStatement, invoking the statement hook before parent traversal. * * Parameters: `statement` - the try-catch statement to visit
    `` | `public void` | `visitTupleExpression(TupleExpression expression)` * Visits a TupleExpression, traversing all contained expressions. * * Parameters: `expression` - the tuple expression
    `` | `public void` | `visitUnaryMinusExpression(UnaryMinusExpression expression)` * Visits a UnaryMinusExpression, traversing the operand expression. * * Parameters: `expression` - the unary minus expression
    `` | `public void` | `visitUnaryPlusExpression(UnaryPlusExpression expression)` * Visits a UnaryPlusExpression, traversing the operand expression. * * Parameters: `expression` - the unary plus expression
    `` | `public void` | `visitVariableExpression(VariableExpression expression)` * Visits a VariableExpression. No traversal is performed as variable expressions contain no child expressions. * * Parameters: `expression` - the variable expression
    `` | `public void` | `visitWhileLoop(WhileStatement statement)` * Visits a WhileStatement, invoking statement hooks before parent traversal. * * Parameters: `statement` - the while statement to visit

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class ClassGenerator` | `getInnerClasses, getSourceUnit, visitBytecodeSequence`
    `class ClassCodeVisitorSupport` | `addError, getSourceUnit, visitAnnotation, visitAnnotations, visitAnnotations, visitAssertStatement, visitBlockStatement, visitBreakStatement, visitCaseStatement, visitCatchStatement, visitClass, visitClassCodeContainer, visitClosureExpression, visitConstructor, visitConstructorOrMethod, visitContinueStatement, visitDeclarationExpression, visitDoWhileLoop, visitExpressionStatement, visitField, visitForLoop, visitIfElse, visitImports, visitMethod, visitObjectInitializerStatements, visitPackage, visitProperty, visitReturnStatement, visitStatement, visitStatementAnnotations, visitSwitch, visitSynchronizedStatement, visitThrowStatement, visitTryCatchFinally, visitWhileLoop`
    `class CodeVisitorSupport` | `afterSwitchCaseStatementsVisited, afterSwitchConditionExpressionVisited, visitArgumentlistExpression, visitArrayExpression, visitAssertStatement, visitAttributeExpression, visitBinaryExpression, visitBitwiseNegationExpression, visitBlockStatement, visitBooleanExpression, visitBreakStatement, visitBytecodeExpression, visitCaseStatement, visitCastExpression, visitCatchStatement, visitClassExpression, visitClosureExpression, visitClosureListExpression, visitConstantExpression, visitConstructorCallExpression, visitContinueStatement, visitDeclarationExpression, visitDoWhileLoop, visitEmptyStatement, visitExpressionStatement, visitFieldExpression, visitForLoop, visitGStringExpression, visitIfElse, visitLambdaExpression, visitListExpression, visitMapEntryExpression, visitMapExpression, visitMethodCallExpression, visitMethodPointerExpression, visitMethodReferenceExpression, visitNotExpression, visitPostfixExpression, visitPrefixExpression, visitPropertyExpression, visitRangeExpression, visitReturnStatement, visitShortTernaryExpression, visitSpreadExpression, visitSpreadMapExpression, visitStaticMethodCallExpression, visitSwitch, visitSynchronizedStatement, visitTernaryExpression, visitThrowStatement, visitTryCatchFinally, visitTupleExpression, visitUnaryMinusExpression, visitUnaryPlusExpression, visitVariableExpression, visitWhileLoop`

- - ### Field Detail

    - #### public static final boolean ASM_DEBUG

      Add marker in the bytecode to show source-bytecode relationship.

    - #### public static final boolean CREATE_DEBUG_INFO

      Enables emission of local-variable and source debug metadata.

    - #### public static final boolean CREATE_LINE_NUMBER_INFO

      Enables emission of line number tables.

    - #### public static final String ELIDE_EXPRESSION_VALUE

      Metadata key used to mark expressions whose value should be discarded.

    - #### public static final String MINIMUM_BYTECODE_VERSION

      Metadata key used to request a minimum emitted bytecode level.

    - #### public static final MethodCallerMultiAdapter getField

      Runtime helper used for dynamic field reads.

    - #### public static final MethodCallerMultiAdapter getGroovyObjectField

      Runtime helper used for dynamic field reads against `GroovyObject` receivers.

    - #### public static final MethodCallerMultiAdapter setField

      Runtime helper used for dynamic field writes.

    - #### public static final MethodCallerMultiAdapter setGroovyObjectField

      Runtime helper used for dynamic field writes against `GroovyObject` receivers.

    - #### public static final MethodCallerMultiAdapter setProperty

      Runtime helper used for dynamic property writes.

  - ### Constructor Detail

    - #### 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 Detail

    - #### 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

    - #### 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

    - #### 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

    - #### 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.

    - #### 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

    - #### public WriterController getController()

      Returns the writer controller coordinating bytecode emission.

      Returns:
        the active writer controller

    - #### 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

    - #### public SourceUnit getSourceUnit()

      * * Provides access to the SourceUnit for error reporting during visitation. * Implementations must override this method. * *

      Returns:
        the source unit for this visitor

    - #### 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).

    - #### 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

    - #### public void loadInstanceField(FieldExpression expression)

      RHS instance field. should move most of the code in the BytecodeHelper

    - #### public void loadStaticField(FieldExpression expression)

      Loads a static field value onto the operand stack.

      Parameters:
        `expression` - the field expression to load

    - #### 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

    - #### 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

    - #### public void throwException(String message)

      Throws a parser exception associated with the current AST node.

      Parameters:
        `message` - the exception message

    - #### public void visitAnnotationAttributes(AnnotationNode an, AnnotationVisitor av)

      Generates the annotation attributes.

      Parameters:
        `an` - the node with an annotation
        `av` - the visitor to use

    - #### public void visitAnnotations(AnnotatedNode node)

      * Visits annotations on an AnnotatedNode, delegating to visitAnnotation(AnnotationNode). * *

      Parameters:
        `node` - the annotated node containing annotations to visit

    - #### public void visitArgumentlistExpression(ArgumentListExpression ale)

      * Visits an ArgumentListExpression, treating it as a tuple expression. * *

      Parameters:
        `expression` - the argument list expression

    - #### public void visitArrayExpression(ArrayExpression expression)

      * Visits an ArrayExpression, traversing element expressions and size expressions. * *

      Parameters:
        `expression` - the array expression

    - #### public void visitAssertStatement(AssertStatement statement)

      * Visits an AssertStatement, invoking the statement hook before parent traversal. * *

      Parameters:
        `statement` - the assert statement to visit

    - #### public void visitAttributeExpression(AttributeExpression expression)

      * Visits an AttributeExpression, traversing the object and attribute name expressions. * *

      Parameters:
        `expression` - the attribute expression

    - #### public void visitBinaryExpression(BinaryExpression expression)

      * Visits a BinaryExpression, traversing left and right operand expressions. * *

      Parameters:
        `expression` - the binary expression

    - #### public void visitBitwiseNegationExpression(BitwiseNegationExpression expression)

      * Visits a BitwiseNegationExpression, traversing the operand expression. * *

      Parameters:
        `expression` - the bitwise negation expression

    - #### public void visitBlockStatement(BlockStatement statement)

      * Visits a BlockStatement, invoking the statement hook before parent traversal. * *

      Parameters:
        `statement` - the block statement to visit

    - #### public void visitBooleanExpression(BooleanExpression expression)

      * Visits a BooleanExpression, traversing the contained expression. * *

      Parameters:
        `expression` - the boolean expression

    - #### public void visitBreakStatement(BreakStatement statement)

      * Visits a BreakStatement, invoking the statement hook before parent traversal. * *

      Parameters:
        `statement` - the break statement to visit

    - #### public void visitBytecodeExpression(BytecodeExpression expression)

      * Visits a BytecodeExpression. No traversal is performed as bytecode expressions are terminal. * *

      Parameters:
        `expression` - the bytecode expression

    - #### public void visitBytecodeSequence(BytecodeSequence bytecodeSequence)

      * Visits a bytecode sequence during AST traversal. Subclasses should override * this method to handle custom bytecode generation. * *

      Parameters:
        `bytecodeSequence` - the bytecode sequence to visit

    - #### public void visitCaseStatement(CaseStatement statement)

      * Visits a CaseStatement, invoking the statement hook before parent traversal. * *

      Parameters:
        `statement` - the case statement to visit

    - #### public void visitCastExpression(CastExpression castExpression)

      * Visits a CastExpression, traversing the operand expression. * *

      Parameters:
        `expression` - the cast expression

    - #### public void visitCatchStatement(CatchStatement statement)

      * Visits a CatchStatement, processing variable annotations and invoking the statement hook. * *

      Parameters:
        `statement` - the catch statement to visit

    - #### public void visitClass(ClassNode classNode)

      * Visits a ClassNode, processing its annotations, package, imports, contents, and object initializers. * *

      Parameters:
        `node` - the class node to visit

    - #### public void visitClassExpression(ClassExpression expression)

      * Visits a ClassExpression. No traversal is performed as class expressions contain no child expressions. * *

      Parameters:
        `expression` - the class expression

    - #### public void visitClosureExpression(ClosureExpression expression)

      * Visits a ClosureExpression with annotation processing, traversing parameter annotations * before delegating to parent traversal. * *

      Parameters:
        `expression` - the closure expression to visit

    - #### public void visitClosureListExpression(ClosureListExpression expression)

      * Visits a ClosureListExpression, traversing all contained expressions. * *

      Parameters:
        `expression` - the closure list expression

    - #### public void visitConstantExpression(ConstantExpression expression)

      Generates byte code for constants.

      See Also:
        Class field types

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

      * Visits a ConstructorNode, processing its annotations, parameter annotations, and code block. * *

      Parameters:
        `node` - the constructor node to visit

    - #### public void visitConstructorCallExpression(ConstructorCallExpression call)

      * Visits a ConstructorCallExpression, traversing its argument list. * *

      Parameters:
        `call` - the constructor call expression

    - #### 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. * *

      Parameters:
        `node` - the method or constructor node *
        `isConstructor` - true if node is a constructor, false if it is a method

    - #### public void visitContinueStatement(ContinueStatement statement)

      * Visits a ContinueStatement, invoking the statement hook before parent traversal. * *

      Parameters:
        `statement` - the continue statement to visit

    - #### public void visitDeclarationExpression(DeclarationExpression expression)

      * Visits a DeclarationExpression with annotation processing, traversing expression annotations * before delegating to parent traversal. * *

      Parameters:
        `expression` - the declaration expression to visit

    - #### public void visitDoWhileLoop(DoWhileStatement statement)

      * Visits a DoWhileStatement, invoking statement hooks before parent traversal. * *

      Parameters:
        `statement` - the do-while statement to visit

    - #### public void visitExpressionStatement(ExpressionStatement statement)

      * Visits an ExpressionStatement, invoking the statement hook before parent traversal. * *

      Parameters:
        `statement` - the expression statement to visit

    - #### public void visitField(FieldNode fieldNode)

      * Visits a FieldNode, processing its annotations and initial value expression if present. * *

      Parameters:
        `node` - the field node to visit

    - #### public void visitFieldExpression(FieldExpression expression)

      * Visits a FieldExpression. No traversal is performed as field expressions contain no child expressions. * *

      Parameters:
        `expression` - the field expression

    - #### public void visitForLoop(ForStatement statement)

      * Visits a ForStatement, invoking statement hooks and processing loop variable annotations. * *

      Parameters:
        `statement` - the for statement to visit

    - #### public void visitGStringExpression(GStringExpression expression)

      * Visits a GStringExpression, traversing string parts and interpolated value expressions. * *

      Parameters:
        `expression` - the GString expression

    - #### public void visitIfElse(IfStatement statement)

      * Visits an IfStatement, invoking the statement hook before parent traversal. * *

      Parameters:
        `statement` - the if statement to visit

    - #### public void visitLambdaExpression(LambdaExpression expression)

      * Visits a LambdaExpression, treating it as a closure expression. * *

      Parameters:
        `expression` - the lambda expression

    - #### public void visitListExpression(ListExpression expression)

      * Visits a ListExpression, traversing all contained expressions. * *

      Parameters:
        `expression` - the list expression

    - #### public void visitMapEntryExpression(MapEntryExpression expression)

      * Visits a MapEntryExpression, traversing key and value expressions. * *

      Parameters:
        `expression` - the map entry expression

    - #### public void visitMapExpression(MapExpression expression)

      * Visits a MapExpression, traversing all map entry expressions. * *

      Parameters:
        `expression` - the map expression

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

      * Visits a MethodNode, processing its annotations, parameter annotations, and code block. * *

      Parameters:
        `node` - the method node to visit

    - #### public void visitMethodCallExpression(MethodCallExpression call)

      * Visits a MethodCallExpression, traversing the object expression, * method expression, and argument list. * *

      Parameters:
        `call` - the method call expression

    - #### public void visitMethodPointerExpression(MethodPointerExpression expression)

      * Visits a MethodPointerExpression, traversing the object and method name expressions. * *

      Parameters:
        `expression` - the method pointer expression

    - #### public void visitMethodReferenceExpression(MethodReferenceExpression expression)

      * Visits a MethodReferenceExpression, treating it as a method pointer. * *

      Parameters:
        `expression` - the method reference expression

    - #### public void visitNotExpression(NotExpression expression)

      * Visits a NotExpression, traversing the operand expression. * *

      Parameters:
        `expression` - the not expression

    - #### public void visitPostfixExpression(PostfixExpression expression)

      * Visits a PostfixExpression, traversing the operand expression. * *

      Parameters:
        `expression` - the postfix expression

    - #### public void visitPrefixExpression(PrefixExpression expression)

      * Visits a PrefixExpression, traversing the operand expression. * *

      Parameters:
        `expression` - the prefix expression

    - #### public void visitProperty(PropertyNode statement)

      * Visits a PropertyNode, processing its annotations, initial value expression, * and getter/setter blocks if present. * *

      Parameters:
        `node` - the property node to visit

    - #### public void visitPropertyExpression(PropertyExpression expression)

      * Visits a PropertyExpression, traversing the object and property name expressions. * *

      Parameters:
        `expression` - the property expression

    - #### public void visitRangeExpression(RangeExpression expression)

      * Visits a RangeExpression, traversing from and to boundary expressions. * *

      Parameters:
        `expression` - the range expression

    - #### public void visitReturnStatement(ReturnStatement statement)

      * Visits a ReturnStatement, invoking the statement hook before parent traversal. * *

      Parameters:
        `statement` - the return statement to visit

    - #### public void visitSpreadExpression(SpreadExpression expression)

      * Visits a SpreadExpression, traversing the operand expression. * *

      Parameters:
        `expression` - the spread expression

    - #### public void visitSpreadMapExpression(SpreadMapExpression expression)

      * Visits a SpreadMapExpression, traversing the operand expression. * *

      Parameters:
        `expression` - the spread map expression

    - #### protected void visitStatement(Statement statement)

      * Hook method called when visiting any Statement. Subclasses may override * to perform common processing on all statements. * *

      Parameters:
        `statement` - the statement being visited

    - #### public void visitStaticMethodCallExpression(StaticMethodCallExpression call)

      * Visits a StaticMethodCallExpression, traversing its argument list. * *

      Parameters:
        `call` - the static method call expression

    - #### public void visitSwitch(SwitchStatement statement)

      * Visits a SwitchStatement, invoking the statement hook before parent traversal. * *

      Parameters:
        `statement` - the switch statement to visit

    - #### public void visitSynchronizedStatement(SynchronizedStatement statement)

      * Visits a SynchronizedStatement, invoking the statement hook before parent traversal. * *

      Parameters:
        `statement` - the synchronized statement to visit

    - #### public void visitTernaryExpression(TernaryExpression expression)

      * Visits a TernaryExpression, traversing the condition, true-branch, and false-branch expressions. * *

      Parameters:
        `expression` - the ternary expression

    - #### public void visitThrowStatement(ThrowStatement statement)

      * Visits a ThrowStatement, invoking the statement hook before parent traversal. * *

      Parameters:
        `statement` - the throw statement to visit

    - #### public void visitTryCatchFinally(TryCatchStatement statement)

      * Visits a TryCatchStatement, invoking the statement hook before parent traversal. * *

      Parameters:
        `statement` - the try-catch statement to visit

    - #### public void visitTupleExpression(TupleExpression expression)

      * Visits a TupleExpression, traversing all contained expressions. * *

      Parameters:
        `expression` - the tuple expression

    - #### public void visitUnaryMinusExpression(UnaryMinusExpression expression)

      * Visits a UnaryMinusExpression, traversing the operand expression. * *

      Parameters:
        `expression` - the unary minus expression

    - #### public void visitUnaryPlusExpression(UnaryPlusExpression expression)

      * Visits a UnaryPlusExpression, traversing the operand expression. * *

      Parameters:
        `expression` - the unary plus expression

    - #### public void visitVariableExpression(VariableExpression expression)

      * Visits a VariableExpression. No traversal is performed as variable expressions contain no child expressions. * *

      Parameters:
        `expression` - the variable expression

    - #### public void visitWhileLoop(WhileStatement statement)

      * Visits a WhileStatement, invoking statement hooks before parent traversal. * *

      Parameters:
        `statement` - the while statement to visit