public class StaticCompilationTransformer
extends ClassCodeExpressionTransformer
Some expressions use symbols as aliases to method calls (<<, +=, ...). In static compilation, if such a method call is found, we transform the original binary expression into a method call expression so that the call gets statically compiled.
| Modifiers | Name | Description |
|---|---|---|
protected static ClassNode |
BYTECODE_ADAPTER_CLASS |
Class node for ScriptBytecodeAdapter. |
protected static Map<Integer, MethodNode> |
BYTECODE_BINARY_ADAPTERS |
Comparison helpers on ScriptBytecodeAdapter keyed by Groovy token type. |
| Constructor and description |
|---|
StaticCompilationTransformer(SourceUnit unit, StaticTypeCheckingVisitor visitor)Creates a static compilation transformer for the supplied source unit and visitor. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public ClassNode |
getClassNode()Returns the class currently enclosing the transformation context. |
|
protected SourceUnit |
getSourceUnit()Returns the source unit currently being transformed. |
|
public StaticTypesTypeChooser |
getTypeChooser()Returns the type chooser used by this transformer. |
|
public Expression |
transform(Expression expr)Dispatches expression transformation to the specialized helper for the expression type. |
|
public void |
visitClass(ClassNode node)Visits a class and then recursively visits its inner classes. |
|
public void |
visitClassCodeContainer(Statement code)Visits a statement container within the current class or method. |
|
protected void |
visitConstructorOrMethod(MethodNode node, boolean isConstructor)Visits a constructor or method unless it is explicitly marked to skip static compilation. |
|
public void |
visitField(FieldNode node)Preserves constant field initializers that must remain inline for later compilation phases. |
Class node for ScriptBytecodeAdapter.
Comparison helpers on ScriptBytecodeAdapter keyed by Groovy token type.
Creates a static compilation transformer for the supplied source unit and visitor.
unit - the source unit being transformedvisitor - the visitor providing type-checking metadataReturns the class currently enclosing the transformation context.
Returns the source unit currently being transformed.
Returns the type chooser used by this transformer.
Dispatches expression transformation to the specialized helper for the expression type.
expr - the expression to transformVisits a class and then recursively visits its inner classes.
node - the class node to processVisits a statement container within the current class or method.
code - the code container to visitVisits a constructor or method unless it is explicitly marked to skip static compilation.
node - the method or constructor to processisConstructor - whether node is a constructorPreserves constant field initializers that must remain inline for later compilation phases.
node - the field to processCopyright © 2003-2026 The Apache Software Foundation. All rights reserved.