Package org.codehaus.groovy.classgen
Class ExtendedVerifier
java.lang.Object
org.codehaus.groovy.ast.CodeVisitorSupport
org.codehaus.groovy.ast.ClassCodeVisitorSupport
org.codehaus.groovy.classgen.ExtendedVerifier
- All Implemented Interfaces:
GroovyClassVisitor,GroovyCodeVisitor,ErrorCollecting
A specialized Groovy AST visitor meant to perform additional verifications upon the
current AST. Currently it does checks on annotated nodes and annotations itself.
Current limitations: - annotations on local variables are not supported
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringDeprecated, for removal: This API element is subject to removal in a future version.This constant is no longer used and will be removed in a future version. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected SourceUnitProvides access to theSourceUnitfor error reporting during visitation.protected voidvisitAnnotations(AnnotatedNode node, int target) Visits the annotations attached to the supplied node for the given target kind.voidvisitClass(ClassNode node) Visits aClassNode, processing its annotations, package, imports, contents, and object initializers.voidVisits aConstructorNode, processing its annotations, parameter annotations, and code block.voidVisits aConstructorCallExpression, traversing its argument list.voidvisitDeclarationExpression(DeclarationExpression expression) Visits aDeclarationExpressionwith annotation processing, traversing expression annotations before delegating to parent traversal.voidvisitField(FieldNode node) Visits aFieldNode, processing its annotations and initial value expression if present.voidvisitMethod(MethodNode node) Visits aMethodNode, processing its annotations, parameter annotations, and code block.voidvisitProperty(PropertyNode node) Visits aPropertyNode, processing its annotations, initial value expression, and getter/setter blocks if present.protected voidvisitStatementAnnotations(Statement statement) Called for each loop statement (for,while,do-while) that carries statement-level annotations.Methods inherited from class org.codehaus.groovy.ast.ClassCodeVisitorSupport
addError, visitAnnotation, visitAnnotations, visitAnnotations, visitAssertStatement, visitBlockStatement, visitBreakStatement, visitCaseStatement, visitCatchStatement, visitClassCodeContainer, visitClosureExpression, visitConstructorOrMethod, visitContinueStatement, visitDoWhileLoop, visitExpressionStatement, visitForLoop, visitIfElse, visitImports, visitObjectInitializerStatements, visitPackage, visitReturnStatement, visitStatement, visitSwitch, visitSynchronizedStatement, visitThrowStatement, visitTryCatchFinally, visitWhileLoopMethods inherited from class org.codehaus.groovy.ast.CodeVisitorSupport
afterSwitchCaseStatementsVisited, afterSwitchConditionExpressionVisited, visitArgumentlistExpression, visitArrayExpression, visitAttributeExpression, visitBinaryExpression, visitBitwiseNegationExpression, visitBooleanExpression, visitBytecodeExpression, visitCastExpression, visitClassExpression, visitClosureListExpression, visitConstantExpression, visitEmptyStatement, visitFieldExpression, visitGStringExpression, visitLambdaExpression, visitListExpression, visitMapEntryExpression, visitMapExpression, visitMethodCallExpression, visitMethodPointerExpression, visitMethodReferenceExpression, visitNotExpression, visitPostfixExpression, visitPrefixExpression, visitPropertyExpression, visitRangeExpression, visitShortTernaryExpression, visitSpreadExpression, visitSpreadMapExpression, visitStaticMethodCallExpression, visitTernaryExpression, visitTupleExpression, visitUnaryMinusExpression, visitUnaryPlusExpression, visitVariableExpressionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.codehaus.groovy.ast.GroovyCodeVisitor
visit, visit, visitEmptyExpression, visitListOfExpressions
-
Field Details
-
JVM_ERROR_MESSAGE
Deprecated, for removal: This API element is subject to removal in a future version.This constant is no longer used and will be removed in a future version.- See Also:
-
-
Constructor Details
-
ExtendedVerifier
Creates a new extended verifier.- Parameters:
sourceUnit- the source unit being verified
-
-
Method Details
-
getSourceUnit
Provides access to theSourceUnitfor error reporting during visitation. Implementations must override this method.- Specified by:
getSourceUnitin classClassCodeVisitorSupport- Returns:
- the source unit for this visitor
-
visitClass
Visits aClassNode, processing its annotations, package, imports, contents, and object initializers.- Specified by:
visitClassin interfaceGroovyClassVisitor- Overrides:
visitClassin classClassCodeVisitorSupport- Parameters:
node- the class node to visit
-
visitField
Visits aFieldNode, processing its annotations and initial value expression if present.- Specified by:
visitFieldin interfaceGroovyClassVisitor- Overrides:
visitFieldin classClassCodeVisitorSupport- Parameters:
node- the field node to visit
-
visitProperty
Visits aPropertyNode, processing its annotations, initial value expression, and getter/setter blocks if present.- Specified by:
visitPropertyin interfaceGroovyClassVisitor- Overrides:
visitPropertyin classClassCodeVisitorSupport- Parameters:
node- the property node to visit
-
visitDeclarationExpression
Visits aDeclarationExpressionwith annotation processing, traversing expression annotations before delegating to parent traversal.- Specified by:
visitDeclarationExpressionin interfaceGroovyCodeVisitor- Overrides:
visitDeclarationExpressionin classClassCodeVisitorSupport- Parameters:
expression- the declaration expression to visit
-
visitConstructorCallExpression
Visits aConstructorCallExpression, traversing its argument list.- Specified by:
visitConstructorCallExpressionin interfaceGroovyCodeVisitor- Overrides:
visitConstructorCallExpressionin classCodeVisitorSupport- Parameters:
expression- the constructor call expression
-
visitConstructor
Visits aConstructorNode, processing its annotations, parameter annotations, and code block.- Specified by:
visitConstructorin interfaceGroovyClassVisitor- Overrides:
visitConstructorin classClassCodeVisitorSupport- Parameters:
node- the constructor node to visit
-
visitMethod
Visits aMethodNode, processing its annotations, parameter annotations, and code block.- Specified by:
visitMethodin interfaceGroovyClassVisitor- Overrides:
visitMethodin classClassCodeVisitorSupport- Parameters:
node- the method node to visit
-
visitStatementAnnotations
Called for each loop statement (for,while,do-while) that carries statement-level annotations. Subclasses may override to process those annotations.- Overrides:
visitStatementAnnotationsin classClassCodeVisitorSupport- Parameters:
statement- the loop statement that may have statement-level annotations
-
visitAnnotations
Visits the annotations attached to the supplied node for the given target kind.- Parameters:
node- the annotated node to inspecttarget- the annotation target mask being validated
-