Given an annotation, return true if it should be documented and false
otherwise.

@param annotationDoc the annotation to check.

@return true return true if it should be documented and false otherwise.
502935
public boolean isDocumentedAnnotation(AnnotationTypeDoc annotationDoc) {
        for (AnnotationDesc anno : annotationDoc.annotations()) {
            if (anno.annotationType().qualifiedName().equals(
                    Documented.class.getName())) {
                return true;
            }
        }
        return false;
    }
1178602
public boolean isDocumentedAnnotation(TypeElement annotation) {
        for (AnnotationMirror anno : annotation.getAnnotationMirrors()) {
            if (getFullyQualifiedName(anno.getAnnotationType().asElement()).equals(
                    Documented.class.getName())) {
                return true;
            }
        }
        return false;
    }
270900
private static boolean exemptedByAnnotation(
      List<? extends AnnotationTree> annotations,
      VisitorState state) {
    for (AnnotationTree annotation : annotations) {
      if (((JCAnnotation) annotation).type != null) {
        TypeSymbol tsym = ((JCAnnotation) annotation).type.tsym;
        if (EXEMPTING_METHOD_ANNOTATIONS.contains(tsym.getQualifiedName().toString())) {
          return true;
        }
      }
    }
    return false;
  }
1189381
private void checkAnnotationReference(Map<String, Candidate> candidatesMap, JAnnotatable annotatable) {
		for (JAnnotationUse annotation : annotatable.annotations()) {
			JAnnotationValue annotationMember = getAnnotationMember(annotation, "value");

			if (annotationMember instanceof JAnnotationArrayMember) {
				checkAnnotationReference(candidatesMap, (JAnnotationArrayMember) annotationMember);

				continue;
			}

			JExpression type = getAnnotationMemberExpression(annotation, "type");

			if (type == null) {
				// Can be the case for @XmlElement(name = "publication-reference", namespace = "http://mycompany.org/exchange")
				// or any other annotation without "type" 
				continue;
			}

			Candidate candidate = candidatesMap.get(generableToString(type).replace(".class", ""));

			if (candidate != null) {
				logger.debug("Candidate " + candidate.getClassName()
				            + " is used in XmlElements/XmlElementRef and hence won't be removed.");
				candidate.unmarkForRemoval();
			}
		}
	}
1248817
public boolean shouldDocument(ClassSymbol sym) {
        return
            (sym.flags_field&Flags.SYNTHETIC) == 0 && // no synthetics
            (docClasses || getClassDoc(sym).tree != null) &&
            isVisible(sym);
    }
663427
protected final boolean checkRequiredAnnotations(Class<?> controllerClazz, Method actionMethod) {
        List<Class<? extends Annotation>> requiredAnnotations = getRequiredAnnotationClasses();
        if (requiredAnnotations == null || requiredAnnotations.size() == 0) {
            return true;
        }
        for (Class<? extends Annotation> requiredAnnotation : requiredAnnotations) {
            if (requiredAnnotation == null) {
                continue;
            }
            BitSet scopeSet = getAnnotationScope(requiredAnnotation);
            if (scopeSet.get(AnnotationScope.METHOD.ordinal())) {
                if (actionMethod.isAnnotationPresent(requiredAnnotation)) {
                    return checkAnnotation(actionMethod.getAnnotation(requiredAnnotation));
                }
            }
            if (scopeSet.get(AnnotationScope.CLASS.ordinal())) {
                if (controllerClazz.isAnnotationPresent(requiredAnnotation)) {
                    return checkAnnotation(actionMethod.getAnnotation(requiredAnnotation));
                }
            }
            if (scopeSet.get(AnnotationScope.ANNOTATION.ordinal())) {
                for (Annotation annotation : actionMethod.getAnnotations()) {
                    if (annotation.annotationType().isAnnotationPresent(requiredAnnotation)) {
                        return checkAnnotation(actionMethod.getAnnotation(requiredAnnotation));
                    }
                }
                for (Annotation annotation : controllerClazz.getAnnotations()) {
                    if (annotation.annotationType().isAnnotationPresent(requiredAnnotation)) {
                        return checkAnnotation(actionMethod.getAnnotation(requiredAnnotation));
                    }
                }
            }
        }
        return false;
    }
275329
boolean documentReference(String reference) {
    if (!lazyInitDocumentation()) {
      return true;
    }

    if (documentation.sees == null) {
      documentation.sees = new ArrayList<>();
    }

    documentation.sees.add(reference);
    return true;
  }
1018062
private static function haveAnnotation($annotationClass, array $annotationList)
    {
        foreach ($annotationList as $annotation) {
            if (is_a($annotation, $annotationClass)) {
                return $annotation;
            }
        }
        return false;
    }
283597
public static boolean compareAnnotatedTypes(AnnotatedType<?> t1, AnnotatedType<?> t2) {
        if (!t1.getJavaClass().equals(t2.getJavaClass())) {
            return false;
        }
        if (!compareAnnotated(t1, t2)) {
            return false;
        }

        if (t1.getFields().size() != t2.getFields().size()) {
            return false;
        }
        Map<Field, AnnotatedField<?>> fields = new HashMap<Field, AnnotatedField<?>>();
        for (AnnotatedField<?> f : t2.getFields()) {
            fields.put(f.getJavaMember(), f);
        }
        for (AnnotatedField<?> f : t1.getFields()) {
            if (fields.containsKey(f.getJavaMember())) {
                if (!compareAnnotatedField(f, fields.get(f.getJavaMember()))) {
                    return false;
                }
            } else {
                return false;
            }
        }

        if (t1.getMethods().size() != t2.getMethods().size()) {
            return false;
        }
        Map<Method, AnnotatedMethod<?>> methods = new HashMap<Method, AnnotatedMethod<?>>();
        for (AnnotatedMethod<?> f : t2.getMethods()) {
            methods.put(f.getJavaMember(), f);
        }
        for (AnnotatedMethod<?> f : t1.getMethods()) {
            if (methods.containsKey(f.getJavaMember())) {
                if (!compareAnnotatedCallable(f, methods.get(f.getJavaMember()))) {
                    return false;
                }
            } else {
                return false;
            }
        }
        if (t1.getConstructors().size() != t2.getConstructors().size()) {
            return false;
        }
        Map<Constructor<?>, AnnotatedConstructor<?>> constructors = new HashMap<Constructor<?>, AnnotatedConstructor<?>>();
        for (AnnotatedConstructor<?> f : t2.getConstructors()) {
            constructors.put(f.getJavaMember(), f);
        }
        for (AnnotatedConstructor<?> f : t1.getConstructors()) {
            if (constructors.containsKey(f.getJavaMember())) {
                if (!compareAnnotatedCallable(f, constructors.get(f.getJavaMember()))) {
                    return false;
                }
            } else {
                return false;
            }
        }
        return true;

    }
843260
public static boolean checkOffsets(CoreMap docAnnotation)
  {
    boolean okay = true;
    String docText = docAnnotation.get(CoreAnnotations.TextAnnotation.class);
    String docId = docAnnotation.get(CoreAnnotations.DocIDAnnotation.class);
    List<CoreLabel> docTokens = docAnnotation.get(CoreAnnotations.TokensAnnotation.class);
    List<CoreMap> sentences = docAnnotation.get(CoreAnnotations.SentencesAnnotation.class);
    for (CoreMap sentence:sentences) {
      String sentText = sentence.get(CoreAnnotations.TextAnnotation.class);
      List<CoreLabel> sentTokens = sentence.get(CoreAnnotations.TokensAnnotation.class);
      int sentBeginChar = sentence.get(CoreAnnotations.CharacterOffsetBeginAnnotation.class);
      int sentEndChar = sentence.get(CoreAnnotations.CharacterOffsetEndAnnotation.class);
      int sentBeginToken = sentence.get(CoreAnnotations.TokenBeginAnnotation.class);
      int sentEndToken = sentence.get(CoreAnnotations.TokenEndAnnotation.class);
      String docTextSpan = docText.substring(sentBeginChar, sentEndChar);
      List<CoreLabel> docTokenSpan = new ArrayList<CoreLabel>(docTokens.subList(sentBeginToken, sentEndToken));
      logger.finer("Checking Document " + docId + " span (" + sentBeginChar + "," + sentEndChar + ") ");
      if (!docTextSpan.equals(sentText) ) {
        okay = false;
        logger.finer("WARNING: Document " + docId + " span does not match sentence");
        logger.finer("DocSpanText: " + docTextSpan);
        logger.finer("SentenceText: " + sentText);
      }
      String sentTokenStr = getTokenText(sentTokens, CoreAnnotations.TextAnnotation.class);
      String docTokenStr = getTokenText(docTokenSpan, CoreAnnotations.TextAnnotation.class);
      if (!docTokenStr.equals(sentTokenStr) ) {
        okay = false;
        logger.finer("WARNING: Document " + docId + " tokens does not match sentence");
        logger.finer("DocSpanTokens: " + docTokenStr);
        logger.finer("SentenceTokens: " + sentTokenStr);
      }
    }
    return okay;
  }
2383
public function hasDocumentDeclaration($entity)
    {
        if ($rootDocument = $this->getClassAnnotation($entity, self::DOCUMENT_CLASS)) {
            return true;
        }

        if ($this->isNested($entity)) {
            return true;
        }

        return false;
    }
907669
public static Predicate<Field> isAnnotatedWith(Class<? extends Annotation>... annotations) {
        return field -> {
            for (Class<? extends Annotation> annotation : annotations) {
                if (field.isAnnotationPresent(annotation)) {
                    return true;
                }
            }
            return false;
        };
    }
1311101
public static boolean isAnnotated(AnnotatedElement element, Class<? extends Annotation> annotationType) {
        return findAnnotation(element, annotationType) != null;
    }
576424
public static boolean isTodoItem(final Document todoItemDoc) {
    return todoItemDoc.containsKey(ID_KEY)
        && todoItemDoc.containsKey(TASK_KEY)
        && todoItemDoc.containsKey(CHECKED_KEY);
  }
167553
public static <T extends AnnotationDescription> ElementMatcher.Junction<T> is(Annotation annotation) {
        return is(AnnotationDescription.ForLoadedAnnotation.of(annotation));
    }
1249590
protected void makeClassDoc(ClassSymbol clazz, TreePath treePath) {
        ClassDocImpl result = classMap.get(clazz);
        if (result != null) {
            if (treePath != null) result.setTreePath(treePath);
            return;
        }
        if (isAnnotationType((JCClassDecl) treePath.getLeaf())) {   // flags of clazz may not yet be set
            result = new AnnotationTypeDocImpl(this, clazz, treePath);
        } else {
            result = new ClassDocImpl(this, clazz, treePath);
        }
        classMap.put(clazz, result);
    }
1014835
private boolean isAnnotatedResponseBody(MethodDoc method) {
		AnnotationDesc[] annotations = method.annotations();
		for (int i = 0; i < annotations.length; i++) {
			if (annotations[i].annotationType().name().equals("ResponseBody")) {
				return true;
			}
		}
		return false;
	}