Top Description Fields Constructors Methods
org.codehaus.groovy.transform

public Class NullCheckASTTransformation

extends AbstractASTTransformation
Class Inheritance
Annotations
@GroovyASTTransformation
phase:INSTRUCTION_SELECTION
Imports
groovy.transform.NullCheck, org.apache.groovy.ast.tools.ConstructorNodeUtils, org.codehaus.groovy.ast.ASTNode, .AnnotatedNode, .AnnotationNode, .ClassHelper, .ClassNode, .ConstructorNode, .MethodNode, .Parameter, org.codehaus.groovy.ast.expr.ConstantExpression, .ConstructorCallExpression, .Expression, org.codehaus.groovy.ast.stmt.BlockStatement, .ThrowStatement, org.codehaus.groovy.classgen.BytecodeSequence, org.codehaus.groovy.control.CompilePhase, .SourceUnit, java.util.List

Handles generation of code for the @NullCheck annotation.

Field Summary

Modifier and TypeField and Description
private static final ClassNode
private static final ConstructorNode
private static final String
private static final String
public static final ClassNode
Inherited from org.codehaus.groovy.transform.AbstractASTTransformation:
RETENTION_CLASSNODEsourceUnit

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private void
adjustMethod(MethodNode mn, boolean includeGenerated)

public static boolean
private static boolean
private boolean
private static boolean
public static ThrowStatement
makeThrowStmt(final String variableName)

public static void
markAsProcessed(MethodNode
the method node to be considered already processed
mn
)

Mark a method as already processed.

public void
visit(ASTNode[]
The ASTnodes when the call was triggered. Element 0 is the AnnotationNode that triggered this annotation to be activated. Element 1 is the AnnotatedNode decorated, such as a MethodNode or ClassNode. For global transformations it is usually safe to ignore this parameter.
nodes
,
SourceUnit
The source unit being compiled. The source unit may contain several classes. For global transformations, information about the AST can be retrieved from this object.
source
)

Implements org.codehaus.groovy.transform.ASTTransformation.visit.

The method is invoked when an AST Transformation is active.
Inherited from org.codehaus.groovy.transform.AbstractASTTransformation:
addErrorcheckIncludeExcludecheckIncludeExcludecheckIncludeExcludeUndefinedAwarecheckIncludeExcludeUndefinedAwarecheckNotInterfacecheckPropertyListcheckPropertyListcheckPropertyListcopyAnnotatedNodeAnnotationscopyAnnotatedNodeAnnotationsdeemedInternalNamegetAnnotationNamegetClassListgetMemberClassListgetMemberClassValuegetMemberClassValuegetMemberIntValuegetMemberListgetMemberStringListgetMemberStringValuegetMemberStringValuegetMemberValuehasAnnotationinitmemberHasValuenonGenericshouldSkipshouldSkipshouldSkipOnDescriptorshouldSkipOnDescriptorUndefinedAwareshouldSkipUndefinedAwareshouldSkipUndefinedAwaretokenize

Field Detail

EXCEPTIONback to summary
private static final ClassNode EXCEPTION
EXCEPTION_STRING_CTORback to summary
private static final ConstructorNode EXCEPTION_STRING_CTOR
NULL_CHECK_IS_PROCESSEDback to summary
private static final String NULL_CHECK_IS_PROCESSED
NULL_CHECK_NAMEback to summary
private static final String NULL_CHECK_NAME
NULL_CHECK_TYPEback to summary
public static final ClassNode NULL_CHECK_TYPE

Constructor Detail

NullCheckASTTransformationback to summary
public NullCheckASTTransformation()

Method Detail

adjustMethodback to summary
private void adjustMethod(MethodNode mn, boolean includeGenerated)
hasIncludeGeneratedback to summary
public static boolean hasIncludeGenerated(ClassNode cNode)
hasIncludeGeneratedback to summary
private static boolean hasIncludeGenerated(AnnotationNode node)
isIncludeGeneratedback to summary
private boolean isIncludeGenerated(AnnotationNode anno)
isMarkedAsProcessedback to summary
private static boolean isMarkedAsProcessed(MethodNode mn)
makeThrowStmtback to summary
public static ThrowStatement makeThrowStmt(final String variableName)
markAsProcessedback to summary
public static void markAsProcessed(MethodNode mn)

Mark a method as already processed.

Parameters
mn:MethodNode

the method node to be considered already processed

visitback to summary
public void visit(ASTNode[] nodes, SourceUnit source)

Implements org.codehaus.groovy.transform.ASTTransformation.visit.

Doc from org.codehaus.groovy.transform.ASTTransformation.visit.

The method is invoked when an AST Transformation is active. For local transformations, it is invoked once each time the local annotation is encountered. For global transformations, it is invoked once for every source unit, which is typically a source file.

Parameters
nodes:ASTNode[]

The ASTnodes when the call was triggered. Element 0 is the AnnotationNode that triggered this annotation to be activated. Element 1 is the AnnotatedNode decorated, such as a MethodNode or ClassNode. For global transformations it is usually safe to ignore this parameter.

source:SourceUnit

The source unit being compiled. The source unit may contain several classes. For global transformations, information about the AST can be retrieved from this object.

Annotations
@Override