[Java] Class StaticCompilationVisitor
- org.codehaus.groovy.transform.sc.StaticCompilationVisitor
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.
- Authors:
- Cedric Champeau
Field Summary
Modifiers | Name | Description |
---|---|---|
static MethodNode | ARRAYLIST_ADD_METHOD | |
static ClassNode | ARRAYLIST_CLASSNODE | |
static MethodNode | ARRAYLIST_CONSTRUCTOR |
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 ClassNode[] |
getTypeCheckingAnnotations() | |
static boolean |
isStaticallyCompiled(AnnotatedNode node) | |
void |
visitClass(ClassNode node) | |
void |
visitConstructorCallExpression(ConstructorCallExpression call) | |
void |
visitForLoop(ForStatement forLoop) | |
void |
visitMethod(MethodNode node) | |
void |
visitMethodCallExpression(MethodCallExpression call) | |
void |
visitPropertyExpression(PropertyExpression pexp) | |
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
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 ClassNode[] getTypeCheckingAnnotations()
public static boolean isStaticallyCompiled(AnnotatedNode node)
@Override public void visitClass(ClassNode node)
@Override public void visitConstructorCallExpression(ConstructorCallExpression call)
@Override public void visitForLoop(ForStatement forLoop)
@Override public void visitMethod(MethodNode node)
@Override public void visitMethodCallExpression(MethodCallExpression call)
@Override public void visitPropertyExpression(PropertyExpression pexp)
@Override public void visitSpreadExpression(SpreadExpression expression)
© 2003-2020 The Apache Software Foundation
Licensed under the Apache license.
https://docs.groovy-lang.org/2.4.21/html/gapi/org/codehaus/groovy/transform/sc/StaticCompilationVisitor.html