Examples of AnnotationNode


Examples of org.codehaus.groovy.ast.AnnotationNode

        if (nodes.length != 2 || !(nodes[0] instanceof AnnotationNode) || !(nodes[1] instanceof AnnotatedNode)) {
            throw new GroovyBugError("Internal error: expecting [AnnotationNode, AnnotatedNode] but got: " + Arrays.asList(nodes));
        }

        AnnotatedNode parent = (AnnotatedNode) nodes[1];
        AnnotationNode annotationNode = (AnnotationNode) nodes[0];

        if (parent instanceof ClassNode) {
            Expression value = annotationNode.getMember("value");
            if (value instanceof ClassExpression) {
                ClassNode targetApi = value.getType().getPlainNodeReference();
                ClassNode classNode = (ClassNode)parent;

                final String fieldName = '$' + Introspector.decapitalize(targetApi.getNameWithoutPackage());
View Full Code Here

Examples of org.codehaus.groovy.ast.AnnotationNode

            throw new RuntimeException("Internal error: wrong types: " + astNodes[0].getClass() +
                  " / " + astNodes[1].getClass());
        }

        AnnotatedNode parent = (AnnotatedNode) astNodes[1];
        AnnotationNode node = (AnnotationNode) astNodes[0];
        if (!MY_TYPE.equals(node.getClassNode()) || !(parent instanceof ClassNode)) {
            return;
        }

        ClassNode classNode = (ClassNode) parent;
        String cName = classNode.getName();
View Full Code Here

Examples of org.codehaus.groovy.ast.AnnotationNode

    }


    @Override
    protected AnnotationNode getMarkerAnnotation() {
        return new AnnotationNode(new ClassNode(ControllerMethod.class).getPlainNodeReference());
    }
View Full Code Here

Examples of org.codehaus.groovy.ast.AnnotationNode

        if (!(astNodes[0] instanceof AnnotationNode) || !(astNodes[1] instanceof AnnotatedNode)) {
            throw new RuntimeException("Internal error: wrong types: " + astNodes[0].getClass() + " / " + astNodes[1].getClass());
        }

        AnnotatedNode parent = (AnnotatedNode) astNodes[1];
        AnnotationNode annotationNode = (AnnotationNode) astNodes[0];
        if (!MY_TYPE.equals(annotationNode.getClassNode()) || !(parent instanceof ClassNode)) {
            return;
        }

        ClassNode classNode = (ClassNode) parent;
        ListExpression values = getListOfClasses(annotationNode);
View Full Code Here

Examples of org.codehaus.groovy.ast.AnnotationNode

        }
       
        MapExpression constructorArguments = new MapExpression();
        constructorArguments.addMapEntryExpression(new MapEntryExpression(new ConstantExpression("testClass"), new ClassExpression(classNode)));
        FieldNode mixinInstanceFieldNode = classNode.addField(fieldName, Modifier.STATIC, fieldType, new ConstructorCallExpression(fieldType, constructorArguments));
        mixinInstanceFieldNode.addAnnotation(new AnnotationNode(ClassHelper.make(MixinInstance.class)));
       
        addJunitRuleFields(classNode);
       
        return mixinInstanceFieldNode;
    }
View Full Code Here

Examples of org.objectweb.asm.tree.AnnotationNode

    super.transform(cn);
  }

  private void removeAnnotation(Iterator i) {
    while (i.hasNext()) {
      AnnotationNode an = (AnnotationNode) i.next();
      if (annotationDesc.equals(an.desc)) {
        i.remove();
      }
    }
  }
View Full Code Here

Examples of org.objectweb.asm.tree.AnnotationNode

    cn.version = (cn.version & 0xFF) < V1_5 ? V1_5 : cn.version;
    boolean isPresent = false;
    if (cn.visibleAnnotations != null) {
      Iterator i = cn.visibleAnnotations.iterator();
      while (i.hasNext()) {
        AnnotationNode an = (AnnotationNode) i.next();
        if (annotationDesc.equals(an.desc)) {
          isPresent = true;
          break;
        }
      }
    }
    if (!isPresent) {
      if (cn.visibleAnnotations == null) {
        cn.visibleAnnotations = new ArrayList(5);
      }
      cn.visibleAnnotations.add(new AnnotationNode(annotationDesc));
    }
    super.transform(cn);
  }
View Full Code Here

Examples of org.objectweb.asm.tree.AnnotationNode

    }
    // TestNG Class annotation and public method.
    if (cn.visibleAnnotations != null) {
      if ((mn.access & ACC_PUBLIC) != 0) {
        for (Object oca : cn.visibleAnnotations) {
          AnnotationNode ca = (AnnotationNode) oca;
          if (ca.desc.equals("Lorg/testng/annotations/Test;")) {
            return true;
          }
        }
      }
    }
    // Various method level annotation
    if (mn.visibleAnnotations != null) {
      for (Object oan : mn.visibleAnnotations) {
        AnnotationNode an = (AnnotationNode) oan;
        if (annotationsSet.contains(an.desc)) {
          return true;
        }
      }
    }
View Full Code Here

Examples of org.objectweb.asm.tree.AnnotationNode

    assertFalse(selector.shouldVisit(cn, mn));

    List<AnnotationNode> annotations = new ArrayList<AnnotationNode>();
    mn.visibleAnnotations = annotations;
    assertFalse(selector.shouldVisit(cn, mn));
    annotations.add(new AnnotationNode( "whatever" ));
    assertFalse(selector.shouldVisit(cn, mn));   
    annotations.add( new AnnotationNode(
        PurrPackageSelector.ANNOTATIONS_TO_INSTRUMENT[2]));
    assertTrue(selector.shouldVisit(cn, mn));
    mn.name = "<init>";
    assertFalse(selector.shouldVisit(cn, mn));
    // cn.visibleAnnotations
View Full Code Here

Examples of org.objectweb.asm.tree.AnnotationNode

                return annotationType.cast(result);
            }

            private Object buildAnnotation(String className)
            {
                AnnotationNode node = nameToNode.get(className);

                if (node == null)
                    return null;

                return createAnnotation(className, node);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.