@GroovyASTTransformation(phase = CompilePhase.SEMANTIC_ANALYSIS) public class SpockTransform implements ASTTransformation { public SpockTransform() {
public void addTransform(Class<? extends ASTTransformation> transform, ASTNode node) { GroovyASTTransformation annotation = transform.getAnnotation(GroovyASTTransformation.class); if (annotation == null) return; Set<ASTNode> nodes = getTransformInstances().get(annotation.phase()).get(transform); if (nodes == null) { nodes = new LinkedHashSet<ASTNode>(); getTransformInstances().get(annotation.phase()).put(transform, nodes); } nodes.add(node); }
@GroovyASTTransformation(phase = CompilePhase.CANONICALIZATION) public class NotYetImplementedASTTransformation extends AbstractASTTransformation {
@org.codehaus.groovy.transform.GroovyASTTransformation(phase = CompilePhase.CLASS_GENERATION) public class ExternalizeVerifierASTTransformation extends org.codehaus.groovy.transform.AbstractASTTransformation { static final Class MY_CLASS = ExternalizeVerifier.class;
private void verifyCompilePhase(AnnotationNode annotation, Class<?> klass) { GroovyASTTransformation transformationClass = klass.getAnnotation(GroovyASTTransformation.class); if (transformationClass != null) { CompilePhase specifiedCompilePhase = transformationClass.phase(); if (specifiedCompilePhase.getPhaseNumber() < CompilePhase.SEMANTIC_ANALYSIS.getPhaseNumber()) { source.getErrorCollector().addError( new SimpleMessage( annotation.getClassNode().getName() + " is defined to be run in compile phase " + specifiedCompilePhase + ". Local AST transformations must run in " + CompilePhase.SEMANTIC_ANALYSIS + " or later!", source)); } } else { source.getErrorCollector().addError( new SimpleMessage("AST transformation implementation classes must be annotated with " + GroovyASTTransformation.class.getName() + ". " + klass.getName() + " lacks this annotation.", source)); } }
@GroovyASTTransformation(phase = CompilePhase.INSTRUCTION_SELECTION) public class StaticCompileTransformation extends StaticTypesTransformation {
public void addTransform(Class<? extends ASTTransformation> transform, ASTNode node) { if (transformInstances == null) getTransformInstancesLazy(); GroovyASTTransformation annotation = transform.getAnnotation(GroovyASTTransformation.class); Set<ASTNode> nodes = transformInstances.get(annotation.phase()).get(transform); if (nodes == null) { nodes = new LinkedHashSet(); transformInstances.get(annotation.phase()).put(transform, nodes); } nodes.add(node); }
@GroovyASTTransformation(phase = CompilePhase.CANONICALIZATION) public class InheritConstructorsASTTransformation extends AbstractASTTransformation {
public void addTransform(Class<? extends ASTTransformation> transform, ASTNode node) { GroovyASTTransformation annotation = transform.getAnnotation(GroovyASTTransformation.class); Set<ASTNode> nodes = getTransformInstances().get(annotation.phase()).get(transform); if (nodes == null) { nodes = new LinkedHashSet<ASTNode>(); getTransformInstances().get(annotation.phase()).put(transform, nodes); } nodes.add(node); }
@GroovyASTTransformation(phase = CompilePhase.CANONICALIZATION) public class SingletonASTTransformation extends AbstractASTTransformation {
public void addTransform(Class<? extends ASTTransformation> transform, ASTNode node) { if (transformInstances == null) getTransformInstancesLazy(); GroovyASTTransformation annotation = transform.getAnnotation(GroovyASTTransformation.class); Set<ASTNode> nodes = transformInstances.get(annotation.phase()).get(transform); if (nodes == null) { nodes = new LinkedHashSet(); transformInstances.get(annotation.phase()).put(transform, nodes); } nodes.add(node); }
@GroovyASTTransformation(phase = CompilePhase.CANONICALIZATION) public class SynchronizedASTTransformation extends AbstractASTTransformation {
@GroovyASTTransformation(phase = CompilePhase.CANONICALIZATION) public class ReadWriteLockASTTransformation extends AbstractASTTransformation {
private void verifyCompilePhase(AnnotationNode annotation, Class klass) { GroovyASTTransformation transformationClass = (GroovyASTTransformation) klass.getAnnotation(GroovyASTTransformation.class); if (transformationClass != null) { CompilePhase specifiedCompilePhase = transformationClass.phase(); if (specifiedCompilePhase.getPhaseNumber() < CompilePhase.SEMANTIC_ANALYSIS.getPhaseNumber()) { source.getErrorCollector().addError( new SimpleMessage( annotation.getClassNode().getName() + " is defined to be run in compile phase " + specifiedCompilePhase + ". Local AST transformations must run in " + CompilePhase.SEMANTIC_ANALYSIS + " or later!", source)); } } }
@GroovyASTTransformation(phase = CompilePhase.CANONICALIZATION) public class IndexedPropertyASTTransformation extends AbstractASTTransformation {
@GroovyASTTransformation(phase = CompilePhase.CANONICALIZATION) public class ExternalizeMethodsASTTransformation extends AbstractASTTransformation { static final Class MY_CLASS = ExternalizeMethods.class;
@GroovyASTTransformation(phase = CompilePhase.INSTRUCTION_SELECTION) public class StaticTypesTransformation implements ASTTransformation, CompilationUnitAware {
@GroovyASTTransformation(phase = CompilePhase.CANONICALIZATION) public class G3839Transform2 implements ASTTransformation, Opcodes{ public void visit(ASTNode[] nodes, SourceUnit sourceUnit) { ClassNode classNode = (ClassNode) nodes[1]; classNode.addField(new FieldNode("f2", ACC_PUBLIC, ClassHelper.OBJECT_TYPE, classNode, null)); } }