Package org.apache.groovy.contracts.ast
Class ModifiesASTTransformation
java.lang.Object
org.apache.groovy.contracts.ast.ModifiesASTTransformation
- All Implemented Interfaces:
ASTTransformation
Handles
Modifies annotations placed on methods.
Extracts the declared modification targets (fields and parameters) from
the annotation closure and stores them as node metadata on the MethodNode.
The metadata key is "groovy.contracts.modifiesFields" and the value is a
Set<String> of field/parameter names. Downstream processors
(such as @Ensures validation) can read this metadata.
- Since:
- 6.0.0
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringNode metadata key for the set of modifiable field/parameter names. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvisit(ASTNode[] nodes, SourceUnit source) Extracts the modifiable targets declared by@Modifiesand stores them as method metadata.
-
Field Details
-
MODIFIES_FIELDS_KEY
Node metadata key for the set of modifiable field/parameter names.- See Also:
-
-
Constructor Details
-
ModifiesASTTransformation
public ModifiesASTTransformation()
-
-
Method Details
-
visit
Extracts the modifiable targets declared by@Modifiesand stores them as method metadata.- Specified by:
visitin interfaceASTTransformation- Parameters:
nodes- the annotated AST nodes supplied by the compilersource- the current source unit
-