protected void visitConstructorOrMethod(MethodNode node, boolean isConstructor) {
   visitAnnotations(node);
   visitClassCodeContainer(node.getCode());
   for (Parameter param : node.getParameters()) {
     visitAnnotations(param);
   }
 }
 /**
  * Adds the annotation to the internal target list if a match is found.
  *
  * @param node the AST node we are processing
  */
 public void visitAnnotations(AnnotatedNode node) {
   super.visitAnnotations(node);
   for (AnnotationNode an : node.getAnnotations()) {
     String name = an.getClassNode().getName();
     if ((GRAB_CLASS_NAME.equals(name))
         || (allowShortGrab && GRAB_SHORT_NAME.equals(name))
         || (grabAliases.contains(name))) {
       grabAnnotations.add(an);
     }
     if ((GRABEXCLUDE_CLASS_NAME.equals(name))
         || (allowShortGrabExcludes && GRABEXCLUDE_SHORT_NAME.equals(name))
         || (grabExcludeAliases.contains(name))) {
       grabExcludeAnnotations.add(an);
     }
     if ((GRABCONFIG_CLASS_NAME.equals(name))
         || (allowShortGrabConfig && GRABCONFIG_SHORT_NAME.equals(name))
         || (grabConfigAliases.contains(name))) {
       grabConfigAnnotations.add(an);
     }
     if ((GRAPES_CLASS_NAME.equals(name))
         || (allowShortGrapes && GRAPES_SHORT_NAME.equals(name))
         || (grapesAliases.contains(name))) {
       grapesAnnotations.add(an);
     }
     if ((GRABRESOLVER_CLASS_NAME.equals(name))
         || (allowShortGrabResolver && GRABRESOLVER_SHORT_NAME.equals(name))
         || (grabResolverAliases.contains(name))) {
       grabResolverAnnotations.add(an);
     }
   }
 }
 public void visitClass(ClassNode node) {
   visitAnnotations(node);
   visitPackage(node.getPackage());
   visitImports(node.getModule());
   node.visitContents(this);
   visitObjectInitializerStatements(node);
 }
 /**
  * Adds the annotation to the internal target list if a match is found.
  *
  * @param node the node to be processed
  */
 public void visitAnnotations(AnnotatedNode node) {
   super.visitAnnotations(node);
   for (AnnotationNode annotation : node.getAnnotations()) {
     if (transforms.containsKey(annotation)) {
       targetNodes.add(new ASTNode[] {annotation, node});
     }
   }
 }
 public void visitImports(ModuleNode node) {
   if (node != null) {
     for (ImportNode importNode : node.getImports()) {
       visitAnnotations(importNode);
       importNode.visit(this);
     }
     for (ImportNode importStarNode : node.getStarImports()) {
       visitAnnotations(importStarNode);
       importStarNode.visit(this);
     }
     for (ImportNode importStaticNode : node.getStaticImports().values()) {
       visitAnnotations(importStaticNode);
       importStaticNode.visit(this);
     }
     for (ImportNode importStaticStarNode : node.getStaticStarImports().values()) {
       visitAnnotations(importStaticStarNode);
       importStaticStarNode.visit(this);
     }
   }
 }
  public void visitProperty(PropertyNode node) {
    visitAnnotations(node);
    Statement statement = node.getGetterBlock();
    visitClassCodeContainer(statement);

    statement = node.getSetterBlock();
    visitClassCodeContainer(statement);

    Expression init = node.getInitialExpression();
    if (init != null) init.visit(this);
  }
  // GRECLIPSE add
  protected void visitAnnotations(Iterable<AnnotationNode> nodes) {
    for (AnnotationNode node : nodes) {
      // skip built-in properties
      if (node.isBuiltIn()) continue;

      Set<AnnotationNode> originals = node.getNodeMetaData("AnnotationCollector");
      if (originals != null && !originals.isEmpty()) {
        visitAnnotations(originals);
      }
      visitAnnotation(node);
    }
  }
  /**
   * If the annotation is annotated with {@link GroovyASTTransformation} the annotation is added to
   * <code>stageVisitors</code> at the appropriate processor visitor.
   *
   * @param node the node to process
   */
  public void visitAnnotations(AnnotatedNode node) {
    super.visitAnnotations(node);
    List<AnnotationNode> collected = new ArrayList<AnnotationNode>();
    for (Iterator<AnnotationNode> it = node.getAnnotations().iterator(); it.hasNext(); ) {
      AnnotationNode annotation = it.next();
      if (addCollectedAnnotations(collected, annotation, node)) it.remove();
    }
    node.getAnnotations().addAll(collected);

    for (AnnotationNode annotation : node.getAnnotations()) {

      // GRECLIPSE: start: under eclipse we may be asking a node that has no backing class
      /*{
      Annotation transformClassAnnotation = getTransformClassAnnotation(annotation.getClassNode());
      if (transformClassAnnotation == null) {
          // skip if there is no such annotation
          continue;
      }
      addTransformsToClassNode(annotation, transformClassAnnotation);
      }*/
      // newcode:
      if (!this.allowTransforms) {
        if (!isAllowed(annotation.getClassNode().getName())) {
          continue;
        }
      }
      // GRECLIPSE end
      String[] transformClassNames = getTransformClassNames(annotation.getClassNode());
      Class[] transformClasses = getTransformClasses(annotation.getClassNode());
      if (transformClassNames == null && transformClasses == null) {
        continue;
      }
      if (transformClassNames == null) {
        transformClassNames = NONE;
      }
      if (transformClasses == null) {
        transformClasses = NO_CLASSES;
      }
      addTransformsToClassNode(annotation, transformClassNames, transformClasses);
      // end
    }
  }
 public void visitAnnotations(AnnotatedNode node) {
   List<AnnotationNode> annotations = node.getAnnotations();
   // GRECLIPSE edit
   if (!annotations.isEmpty()) visitAnnotations(annotations);
   // GRECLIPSE end
 }
 public void visitPackage(PackageNode node) {
   if (node != null) {
     visitAnnotations(node);
     node.visit(this);
   }
 }
 public void visitField(FieldNode node) {
   visitAnnotations(node);
   Expression init = node.getInitialExpression();
   if (init != null) init.visit(this);
 }
 @Override
 public void visitDeclarationExpression(DeclarationExpression expression) {
   visitAnnotations(expression);
   super.visitDeclarationExpression(expression);
 }
 @Override
 public final void visitAnnotations(AnnotatedNode node) {
   super.visitAnnotations(node);
 }