Returns whether the given token is the first token covered by the given annotation.

@param token      the token
@param annotation the annotation
@return whether the token is the first covered token
487759
public static boolean isFirstCoveredToken(final Token token, final Annotation annotation)
    {
        final JCas jCas = getJCas(annotation);
        final List<Token> coveredTokens = JCasUtil.selectCovered(jCas, Token.class, annotation);

        if (coveredTokens.isEmpty()) {
            return false;
        }
        else {
            final Token firstCoveredToken = coveredTokens.get(0);
            return haveSameSpan(token, firstCoveredToken);
        }
    }
948337
public static boolean annotationTypeMatches(Class<? extends Annotation> type, JavacNode node) {
		if (node.getKind() != Kind.ANNOTATION) return false;
		return typeMatches(type, node, ((JCAnnotation) node.get()).annotationType);
	}
3782
public <T extends Annotation> boolean isAnnotationPresentOnField( Class<T> annotation ) {
        return CreatorUtils.isAnnotationPresent( annotation, fields );
    }
350091
private void getFirstToken(StreamTokenizer tokenizer) throws IOException {
        while (tokenizer.nextToken() == StreamTokenizer.TT_EOL) {
        }

        if ((tokenizer.ttype == '\'') || (tokenizer.ttype == '"')) {
            tokenizer.ttype = StreamTokenizer.TT_WORD;
        } else if ((tokenizer.ttype == StreamTokenizer.TT_WORD) && (tokenizer.sval.equals("?"))) {
            tokenizer.ttype = '?';
        }
    }
17049
private boolean hasAnnotation(JavaAnnotatedElement clazz, Class<? extends Annotation> annotationClazz) {
    return clazz.getAnnotations().stream()
        .filter(item -> item.getType().isA(annotationClazz.getName()))
        .count() > 0;
  }
7390
private static <A extends Annotation> A getAnnotation(AnnotatedElement element, Class<A> annotationClass) {
        return (element != null) ? element.getAnnotation(annotationClass) : null;
    }
287908
public boolean hasDeclaredMethodAnnotation(final String methodAnnotationName) {
        for (final MethodInfo mi : getDeclaredMethodInfo()) {
            if (mi.hasAnnotation(methodAnnotationName)) {
                return true;
            }
        }
        return false;
    }
965449
@Check
	public void checkManualInlineDefinition(XtendAnnotationTarget annotationTarget) {
		if (!isIgnored(MANUAL_INLINE_DEFINITION)) {
			if (annotationTarget.getAnnotations().isEmpty() || !isRelevantAnnotationTarget(annotationTarget)) {
				return;
			}
			final String inlineAnnotation = Inline.class.getName();
			for (final XAnnotation annotation : annotationTarget.getAnnotations()) {
				final JvmType type = annotation.getAnnotationType();
				if (type != null && !type.eIsProxy()) {
					if (Objects.equal(type.getIdentifier(), inlineAnnotation)) {
						addIssue(
								Messages.SARLValidator_16,
								annotation,
								MANUAL_INLINE_DEFINITION);
					}
				}
			}
		}
	}
508689
private Description checkAnnotations(
      Tree tree,
      int treePos,
      List<? extends AnnotationTree> annotations,
      Comment danglingJavadoc,
      int firstModifierPos,
      int lastModifierPos,
      VisitorState state) {
    SuggestedFix.Builder builder = SuggestedFix.builder();
    List<AnnotationTree> moveBefore = new ArrayList<>();
    List<AnnotationTree> moveAfter = new ArrayList<>();

    boolean annotationProblem = false;
    for (AnnotationTree annotation : annotations) {
      int annotationPos = ((JCTree) annotation).getStartPosition();
      if (annotationPos <= firstModifierPos) {
        continue;
      }
      AnnotationType annotationType =
          ASTHelpers.getAnnotationType(annotation, getSymbol(tree), state);
      if (annotationPos >= lastModifierPos) {
        if (tree instanceof ClassTree || annotationType == AnnotationType.DECLARATION) {
          annotationProblem = true;
          moveBefore.add(annotation);
        }
      } else {
        annotationProblem = true;
        if (tree instanceof ClassTree
            || annotationType == AnnotationType.DECLARATION
            || annotationType == null) {
          moveBefore.add(annotation);
        } else {
          moveAfter.add(annotation);
        }
      }
    }
    if (annotationProblem) {
      for (AnnotationTree annotation : moveBefore) {
        builder.delete(annotation);
      }
      for (AnnotationTree annotation : moveAfter) {
        builder.delete(annotation);
      }
      String javadoc =
          danglingJavadoc == null ? "" : removeJavadoc(state, treePos, danglingJavadoc, builder);
      builder
          .replace(
              firstModifierPos,
              firstModifierPos,
              String.format("%s%s ", javadoc, joinSource(state, moveBefore)))
          .replace(
              lastModifierPos, lastModifierPos, String.format("%s ", joinSource(state, moveAfter)));
      ImmutableList<String> names =
          annotations.stream()
              .map(ASTHelpers::getSymbol)
              .filter(Objects::nonNull)
              .map(Symbol::getSimpleName)
              .map(a -> "@" + a)
              .collect(toImmutableList());
      String flattened = names.stream().collect(joining(", "));
      String isAre = names.size() > 1 ? "are not type annotations" : "is not a type annotation";
      String message =
          String.format(
              "%s %s, so should appear before any modifiers and after Javadocs.", flattened, isAre);
      return buildDescription(tree).setMessage(message).addFix(builder.build()).build();
    }
    return NO_MATCH;
  }
4791
public static <T> Qualifier<T> byAnnotation(Annotation annotation) {
        if (annotation.annotationType() == Type.class) {
            Type typeAnn = (Type) annotation;
            return byType(typeAnn.value());
        } else if (annotation.annotationType() == Named.class) {
            Named nameAnn = (Named) annotation;
            return byName(nameAnn.value());
        } else {
            return new AnnotationQualifier<>(annotation);
        }
    }
704083
def is_token_annotation_tier(self, tier):
        
        for i, event in enumerate(tier.iter('event')):
            if self.indexdelta(event.attrib['end'], event.attrib['start']) != 1:
                return False
        return True
1310964
public Annotation getAnnotation(final Class<? extends Annotation> clazz) {
        final List<Annotation> found = foundAnnotations.get(clazz);
        return found == null || found.isEmpty() ? null : found.get(found.size() - 1);
    }
1107734
public <A extends Annotation> boolean hasAnnotation(final Field field, final Class<A> annClass) {
        return getAnnotation(field, annClass) != null;
    }
830382
public static Predicate<Class<?>> isAnnotatedWith(Class<? extends Annotation>... annotations) {
        return clazz -> {
            for (Class<? extends Annotation> annotation : annotations) {
                if (clazz.isAnnotationPresent(annotation)) {
                    return true;
                }
            }
            return false;
        };
    }
490141
public Annotation getFirstAnnotation(final Class<? extends Annotation> clazz) {
        final List<Annotation> found = foundAnnotations.get(clazz);
        return found == null || found.isEmpty() ? null : found.get(0);
    }
1057745
private boolean containsAnnotation(List<AnnotationExpr> annos, String annotationName) {
        for (AnnotationExpr anno : annos) {
            if (anno.getName().getName().equals(annotationName)) {
                return true;
            }
        }
        return false;
    }
1283583
private boolean isSupportedAnnotation(final Annotation anno) {

        final String name = anno.annotationType().getName();
        if(name.startsWith("java.lang.annotation.")) {
            return false;
        }

        return true;
    }