@GroovyASTTransformation(phase = CompilePhase.INSTRUCTION_SELECTION)
public class NullCheckASTTransformation
extends AbstractASTTransformation
Handles generation of code for the
| Modifiers | Name | Description |
|---|---|---|
static ClassNode |
NULL_CHECK_TYPE |
ClassNode for NullCheck. |
| Fields inherited from class | Fields |
|---|---|
class AbstractASTTransformation |
RETENTION_CLASSNODE, sourceUnit |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public static boolean |
hasIncludeGenerated(ClassNode cNode)Reports whether cNode carries NullCheck with includeGenerated
set to the constant true. |
|
public static ThrowStatement |
makeThrowStmt(String variableName)Builds throw new IllegalArgumentException(variableName + " cannot be null"),
and marks the String constructor as the direct call target. |
|
public static void |
markAsProcessed(MethodNode mn)Mark a method as already processed. |
|
public void |
visit(ASTNode[] nodes, SourceUnit source) |
Reports whether cNode carries NullCheck with includeGenerated
set to the constant true. No such annotation, or a non-constant member,
returns false. Only the first NullCheck on the class is read.
cNode - the class whose annotations are inspectedtrue when generated members should receive null checks Builds throw new IllegalArgumentException(variableName + " cannot be null"),
and marks the String constructor as the direct call target.
variableName - name inserted into the exception messageMark a method as already processed.
mn - the method node to be considered already processed