Copies annotation from the trait to the helper, excluding the trait annotation itself
@param cNode the trait class node
@param helper the helper class node
556279
private static void copyClassAnnotations(final ClassNode cNode, final ClassNode helper) {
        List<AnnotationNode> annotations = cNode.getAnnotations();
        for (AnnotationNode annotation : annotations) {
            if (!annotation.getClassNode().equals(Traits.TRAIT_CLASSNODE)) {
                helper.addAnnotation(annotation);
            }
        }
    }
1111999
public static boolean hasAnnotation(final MethodNode methodNode, final Class<? extends Annotation> annotationClass) {
        return !methodNode.getAnnotations(new ClassNode(annotationClass)).isEmpty();
    }
1037701
public void setEnclosedAnnot(Annotation v) {
    if (Keep_Type.featOkTst && ((Keep_Type)jcasType).casFeat_enclosedAnnot == null)
      jcasType.jcas.throwFeatMissing("enclosedAnnot", "ch.epfl.bbp.uima.types.Keep");
    jcasType.ll_cas.ll_setRefValue(addr, ((Keep_Type)jcasType).casFeatCode_enclosedAnnot, jcasType.ll_cas.ll_getFSRef(v));}
316886
public static <T extends AnnotationDescription> ElementMatcher.Junction<T> annotationType(ElementMatcher<? super TypeDescription> matcher) {
        return new AnnotationTypeMatcher<T>(matcher);
    }
759088
public static void deleteAnnotationIfNeccessary(JavacNode annotation, Class<? extends Annotation> annotationType) {
		deleteAnnotationIfNeccessary0(annotation, annotationType.getName());
	}
653995
public static void addGeneratedMethod(ClassNode cNode, MethodNode mNode) {
        cNode.addMethod(mNode);
        markAsGenerated(cNode, mNode);
    }
841347
public static Optional<Annotation> getQualifier(AnnotatedElement annotatedElement) {
        AnnotatedElement cleanedAnnotatedElement;
        if (annotatedElement instanceof Class<?>) {
            cleanedAnnotatedElement = ProxyUtils.cleanProxy((Class<?>) annotatedElement);
        } else {
            cleanedAnnotatedElement = annotatedElement;
        }
        return Annotations.on(cleanedAnnotatedElement)
                .findAll()
                .filter(AnnotationPredicates.annotationAnnotatedWith(Qualifier.class, false))
                .findFirst();
    }
1293315
public static AnnotationNode addAnnotationOrGetExisting(ClassNode classNode, Class<? extends Annotation> annotationClass, Map<String, Object> members) {
        ClassNode annotationClassNode = ClassHelper.make(annotationClass);
        return addAnnotationOrGetExisting(classNode, annotationClassNode, members);
    }
903917
private static<T extends ParamValidator> void addValidators (ConcurrentHashMap<Class, List<ParamValidator>> map, Class<T> clazz,
                                                                 T requiredValidator, T noneRequiredValidator) {

        // use <CopyOnWriteArrayList> in case validators are added while initializing parameters through <getValidator> method.
        List validators = new CopyOnWriteArrayList(new ParamValidator[]{requiredValidator, noneRequiredValidator});
        map.put(clazz, validators);
    }
1191018
protected void addAnnotation(EObject element, XAnnotation annotation,
			IModificationContext context) throws Exception {
		final ICompositeNode node = NodeModelUtils.findActualNodeFor(annotation);
		if (node != null) {
			final IXtextDocument document = context.getXtextDocument();
			final int startOffset = node.getOffset();
			final int parameterOffset = getTools().getOffsetForPattern(document, startOffset,
					"@\\s*" + toPattern(annotation.getAnnotationType().getQualifiedName()) //$NON-NLS-1$
					+ "\\s*\\(\\s*"); //$NON-NLS-1$
			final int insertOffset;
			if (document.getChar(parameterOffset) == '{') {
				insertOffset = parameterOffset + getTools().getSpaceSize(document, parameterOffset + 1) + 1;
			} else {
				insertOffset = parameterOffset;
			}
			final ReplacingAppendable appendable = getTools().getAppendableFactory().create(document,
					(XtextResource) element.eResource(), insertOffset, 0);
			appendable.append("\""); //$NON-NLS-1$
			appendable.append(extractId(this.code));
			appendable.append("\", "); //$NON-NLS-1$
			appendable.commitChanges();
		}
	}
175405
private Type extractContainingType(Attribute.Compound ca,
                                       DiagnosticPosition pos,
                                       TypeSymbol annoDecl)
    {
        // The next three checks check that the Repeatable annotation
        // on the declaration of the annotation type that is repeating is
        // valid.

        // Repeatable must have at least one element
        if (ca.values.isEmpty()) {
            log.error(pos, "invalid.repeatable.annotation", annoDecl);
            return null;
        }
        Pair<MethodSymbol,Attribute> p = ca.values.head;
        Name name = p.fst.name;
        if (name != names.value) { // should contain only one element, named "value"
            log.error(pos, "invalid.repeatable.annotation", annoDecl);
            return null;
        }
        if (!(p.snd instanceof Attribute.Class)) { // check that the value of "value" is an Attribute.Class
            log.error(pos, "invalid.repeatable.annotation", annoDecl);
            return null;
        }

        return ((Attribute.Class)p.snd).getValue();
    }
951629
public static Node toNode(Source s) {
        Node n = tryExtractNodeFromDOMSource(s);
        return n != null ? n 
            : toDocument(s, DocumentBuilderFactoryConfigurer.Default.configure(DocumentBuilderFactory.newInstance()));
    }
51794
public Node renameNode(Node arg0, String arg1, String arg2) throws DOMException {
	// dynamic load to support jre 1.4 and 1.5
	try {
	    Method m = doc.getClass().getMethod("renameNode", new Class[] { arg0.getClass(), arg1.getClass(), arg2.getClass() });
	    return Caster.toNode(m.invoke(doc, new Object[] { arg0, arg1, arg2 }));
	}
	catch (Exception e) {
	    throw new PageRuntimeException(Caster.toPageException(e));
	}
    }
243788
public static Node copyTreeToNode(Node tree, Node node)
    {
        DOMResult result = new DOMResult(node);
        if (Utility.copyTreeToResult(tree, result))
            return node.getLastChild();
        else
            return null;    // Failure
    }
794893
private static void renameMethod(ClassNode buildee, MethodNode mNode, String newName) {
        buildee.addMethod(newName, mNode.getModifiers(), mNode.getReturnType(), mNode.getParameters(), mNode.getExceptions(), mNode.getCode());
        buildee.removeMethod(mNode);
    }
190498
public AnnotationValidator createAnnotationValidator(ValidateWith validateWithAnnotation) {
        AnnotationValidator validator = VALIDATORS_FOR_ANNOTATION_TYPES.get(validateWithAnnotation);
        if (validator != null) {
            return validator;
        }

        Class<? extends AnnotationValidator> clazz = validateWithAnnotation.value();
        try {
            AnnotationValidator annotationValidator = clazz.newInstance();
            VALIDATORS_FOR_ANNOTATION_TYPES.putIfAbsent(validateWithAnnotation, annotationValidator);
            return VALIDATORS_FOR_ANNOTATION_TYPES.get(validateWithAnnotation);
        } catch (Exception e) {
            throw new RuntimeException("Exception received when creating AnnotationValidator class " + clazz.getName(), e);
        }
    }
857344
public static void addDeclaredMethodsFromInterfaces(ClassNode cNode, Map<String, MethodNode> methodsMap) {
        // add in unimplemented abstract methods from the interfaces
        for (ClassNode iface : cNode.getInterfaces()) {
            Map<String, MethodNode> ifaceMethodsMap = iface.getDeclaredMethodsMap();
            for (Map.Entry<String, MethodNode> entry : ifaceMethodsMap.entrySet()) {
                String methSig = entry.getKey();
                if (!methodsMap.containsKey(methSig)) {
                    methodsMap.put(methSig, entry.getValue());
                }
            }
        }
    }