[Java] Class StaticCompilationVisitor
- org.codehaus.groovy.transform.sc.StaticCompilationVisitor
public class StaticCompilationVisitor extends StaticTypeCheckingVisitor
This visitor is responsible for amending the AST with static compilation metadata or transform the AST so that a class or a method can be statically compiled. It may also throw errors specific to static compilation which are not considered as an error at the type check pass. For example, usage of spread operator is not allowed in statically compiled portions of code, while it may be statically checked. Static compilation relies on static type checking, which explains why this visitor extends the type checker visitor.
Field Summary
Modifiers | Name | Description |
---|---|---|
static MethodNode | ARRAYLIST_ADD_METHOD | |
static ClassNode | ARRAYLIST_CLASSNODE | |
static MethodNode | ARRAYLIST_CONSTRUCTOR | |
static ClassNode | COMPILESTATIC_CLASSNODE | |
static ClassNode | TYPECHECKED_CLASSNODE |
Constructor Summary
Constructor and description |
---|
StaticCompilationVisitor
(SourceUnit unit, ClassNode node) |
Methods Summary
Type Params | Return Type | Name and description |
---|---|---|
protected boolean |
existsProperty(PropertyExpression pexp, boolean checkForReadOnly, ClassCodeVisitorSupport visitor) | |
protected MethodNode |
findMethodOrFail(Expression expr, ClassNode receiver, String name, ClassNode args) | |
protected SourceUnit |
getSourceUnit() | |
protected ClassNode[] |
getTypeCheckingAnnotations() | |
public static boolean |
isStaticallyCompiled(AnnotatedNode node) | |
public void |
visitClass(ClassNode node) | |
public void |
visitConstructorCallExpression(ConstructorCallExpression call) | |
public void |
visitField(FieldNode node) | |
public void |
visitForLoop(ForStatement statement) | |
public void |
visitMethod(MethodNode node) | |
public void |
visitMethod(MethodNode node) | |
public void |
visitMethodCallExpression(MethodCallExpression call) | |
public void |
visitProperty(PropertyNode node) | |
public void |
visitPropertyExpression(PropertyExpression expression) | |
public void |
visitSpreadExpression(SpreadExpression expression) |
Inherited Methods Summary
Field Detail
public static final MethodNode ARRAYLIST_ADD_METHOD
public static final ClassNode ARRAYLIST_CLASSNODE
public static final MethodNode ARRAYLIST_CONSTRUCTOR
public static final ClassNode COMPILESTATIC_CLASSNODE
public static final ClassNode TYPECHECKED_CLASSNODE
Constructor Detail
public StaticCompilationVisitor(SourceUnit unit, ClassNode node)
Method Detail
@Override protected boolean existsProperty(PropertyExpression pexp, boolean checkForReadOnly, ClassCodeVisitorSupport visitor)
@Override protected MethodNode findMethodOrFail(Expression expr, ClassNode receiver, String name, ClassNode args)
@Override protected SourceUnit getSourceUnit()
@Override protected ClassNode[] getTypeCheckingAnnotations()
public static boolean isStaticallyCompiled(AnnotatedNode node)
@Override public void visitClass(ClassNode node)
@Override public void visitConstructorCallExpression(ConstructorCallExpression call)
@Override public void visitField(FieldNode node)
@Override public void visitForLoop(ForStatement statement)
@Override public void visitMethod(MethodNode node)
@Override public void visitMethod(MethodNode node)
@Override public void visitMethodCallExpression(MethodCallExpression call)
@Override public void visitProperty(PropertyNode node)
@Override public void visitPropertyExpression(PropertyExpression expression)
@Override public void visitSpreadExpression(SpreadExpression expression)
© 2003-2020 The Apache Software Foundation
Licensed under the Apache license.
https://docs.groovy-lang.org/3.0.7/html/gapi/org/codehaus/groovy/transform/sc/StaticCompilationVisitor.html