public class InnerClassVisitor
extends InnerClassVisitorHelper
Processes inner classes during compilation, handling the creation of synthetic fields and parameters needed for inner class instances to reference their enclosing instances. This visitor identifies and transforms inner class constructor calls to pass the appropriate enclosing instance references.
| Constructor and description |
|---|
InnerClassVisitor(CompilationUnit cu, SourceUnit su)Creates a new inner class visitor. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
protected SourceUnit |
getSourceUnit()* Provides access to the SourceUnit for error reporting during visitation. * Implementations must override this method. * *
|
|
public void |
visitClass(ClassNode node)* Visits a ClassNode, processing its annotations, package, imports, contents, and object initializers. * *
|
|
public void |
visitClosureExpression(ClosureExpression closure)* Visits a ClosureExpression with annotation processing, traversing parameter annotations * before delegating to parent traversal. * *
|
|
public 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). * Processes the node's annotations, all parameter annotations, and code block. * *
|
|
public void |
visitField(FieldNode node)* Visits a FieldNode, processing its annotations and initial value expression if present. * *
|
|
protected void |
visitObjectInitializerStatements(ClassNode node)* Visits all object initializer statements in a class, typically static or instance initialization blocks. * *
|
|
public void |
visitProperty(PropertyNode node)* Visits a PropertyNode, processing its annotations, initial value expression, * and getter/setter blocks if present. * *
|
Creates a new inner class visitor.
cu - the compilation unit (currently unused but kept for API compatibility)su - the source unit for error reporting* Provides access to the SourceUnit for error reporting during visitation. * Implementations must override this method. * *
* Visits a ClassNode, processing its annotations, package, imports, contents, and object initializers. * *
node - the class node to visit* Visits a ClosureExpression with annotation processing, traversing parameter annotations * before delegating to parent traversal. * *
expression - the closure expression to visit* Visits a ConstructorCallExpression, traversing its argument list. * *
call - the constructor call expression* Visits a constructor or method node (implementation detail for both visit methods). * Processes the node's annotations, all parameter annotations, and code block. * *
node - the method or constructor node
*isConstructor - true if node is a constructor, false if it is a method* Visits a FieldNode, processing its annotations and initial value expression if present. * *
node - the field node to visit* Visits all object initializer statements in a class, typically static or instance initialization blocks. * *
node - the class node containing initializer statements* Visits a PropertyNode, processing its annotations, initial value expression, * and getter/setter blocks if present. * *
node - the property node to visitCopyright © 2003-2026 The Apache Software Foundation. All rights reserved.