org. will add a list
of annotations that this visitor should be concerned about. All other
annotations are ignored, whether or not they are GroovyASTTransformation
annotated or not.
A Two-pass method is used. First all candidate annotations are added to a list then the transformations are called on those collected annotations. This is done to avoid concurrent modification exceptions during the AST tree walk and allows the transformations to alter any portion of the AST tree. Hence annotations that are added in this phase will not be processed as transformations. They will only be handled in later phases (and then only if the type was in the AST prior to any AST transformations being run against it).
| Modifier and Type | Field and Description |
|---|---|
| private static final Tuple3 | |
| private final ASTTransformationsContext | |
| private final CompilePhase | |
| private SourceUnit | |
| private List | |
| private Map |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static void | |
| public static void | |
| public static void | |
| private static void | addPhaseOperationsForGlobalTransforms(CompilationUnit compilationUnit, Map<String, URL> transformNames, boolean isFirstScan)
|
| private List | |
| private static void | |
| protected SourceUnit | |
| public void | visitAnnotations(final AnnotatedNode
the node to be processed node)Overrides org. |
| public void | visitClass(ClassNode
the class to visit classNode)Overrides org. Implements org. |
| COMPILEDYNAMIC_AND_COMPILESTATIC_AND_TYPECHECKED | back to summary |
|---|---|
| private static final Tuple3<String, String, String> COMPILEDYNAMIC_AND_COMPILESTATIC_AND_TYPECHECKED | |
| context | back to summary |
|---|---|
| private final ASTTransformationsContext context | |
| phase | back to summary |
|---|---|
| private final CompilePhase phase | |
| source | back to summary |
|---|---|
| private SourceUnit source | |
| targetNodes | back to summary |
|---|---|
| private List<ASTNode[]> targetNodes | |
| transforms | back to summary |
|---|---|
| private Map<ASTNode, List<ASTTransformation>> transforms | |
| ASTTransformationVisitor | back to summary |
|---|---|
| private ASTTransformationVisitor(final CompilePhase phase, final ASTTransformationsContext context) | |
| addGlobalTransforms | back to summary |
|---|---|
| public static void addGlobalTransforms(ASTTransformationsContext context) | |
| addGlobalTransformsAfterGrab | back to summary |
|---|---|
| public static void addGlobalTransformsAfterGrab(ASTTransformationsContext context) | |
| addPhaseOperations | back to summary |
|---|---|
| public static void addPhaseOperations(final CompilationUnit compilationUnit) | |
| addPhaseOperationsForGlobalTransforms | back to summary |
|---|---|
| private static void addPhaseOperationsForGlobalTransforms(CompilationUnit compilationUnit, Map<String, URL> transformNames, boolean isFirstScan) | |
| distinctAnnotations | back to summary |
|---|---|
| private List | |
| doAddGlobalTransforms | back to summary |
|---|---|
| private static void doAddGlobalTransforms(ASTTransformationsContext context, boolean isFirstScan) | |
| getSourceUnit | back to summary |
|---|---|
| protected SourceUnit getSourceUnit() Implements abstract org. | |
| visitAnnotations | back to summary |
|---|---|
| public void visitAnnotations(final AnnotatedNode node) Overrides org. Adds the annotation to the internal target list if a match is found.
| |
| visitClass | back to summary |
|---|---|
| public void visitClass(ClassNode classNode) Overrides org. Implements org. Main loop entry. First, it delegates to the super visitClass so we can collect the relevant annotations in an AST tree walk. Second, it calls the visit method on the transformation for each relevant annotation found.
| |