Program: 62690
Project: 62690
Buggy source:
/** 
 * Finds an annotation for the given class element and stereotypes. A stereotype is a meta annotation on another annotation.
 * @param element     The element to search
 * @param stereotypes The stereotypes to look for
 * @return An array of matching {@link AnnotationMirror}
 */
AnnotationMirror[] findAnnotationsWithStereotype(Element element,String... stereotypes){
  if (element == null) {
    return new AnnotationMirror[0];
  }
  List<String> stereoTypeList=Arrays.asList(stereotypes);
  List<AnnotationMirror> annotationMirrorList=new ArrayList<>();
  List<? extends AnnotationMirror> annotationMirrors=elementUtils.getAllAnnotationMirrors(element);
  for (  AnnotationMirror ann : annotationMirrors) {
    DeclaredType annotationType=ann.getAnnotationType();
    String annotationTypeString=annotationType.toString();
    if (stereoTypeList.contains(annotationTypeString)) {
      annotationMirrorList.add(ann);
    }
 else {
      Element annotationElement=annotationType.asElement();
      if (!IGNORED_ANNOTATIONS.contains(annotationElement.getSimpleName().toString())) {
        if (hasStereotype(annotationElement,stereotypes)) {
          annotationMirrorList.add(ann);
        }
      }
    }
  }
  if (element instanceof ExecutableElement && annotationMirrorList.isEmpty()) {
    ExecutableElement executableElement=(ExecutableElement)element;
    if (findAnnotation(element,Override.class) != null) {
      ExecutableElement overridden=findOverriddenMethod(executableElement);
      if (overridden != null) {
        return findAnnotationsWithStereotype(overridden,stereotypes);
      }
    }
  }
  return annotationMirrorList.toArray(new AnnotationMirror[annotationMirrorList.size()]);
}

Fixed version (ground truth):
/** 
 * Finds an annotation for the given class element and stereotypes. A stereotype is a meta annotation on another annotation.
 * @param element     The element to search
 * @param stereotypes The stereotypes to look for
 * @return An array of matching {@link AnnotationMirror}
 */
AnnotationMirror[] findAnnotationsWithStereotype(Element element,String... stereotypes){
  if (element == null) {
    return new AnnotationMirror[0];
  }
  List<String> stereoTypeList=Arrays.asList(stereotypes);
  List<AnnotationMirror> annotationMirrorList=new ArrayList<>();
  Set<? extends AnnotationMirror> annotationMirrors=getAllAnnotationMirrors(element);
  for (  AnnotationMirror ann : annotationMirrors) {
    DeclaredType annotationType=ann.getAnnotationType();
    String annotationTypeString=annotationType.toString();
    if (stereoTypeList.contains(annotationTypeString)) {
      annotationMirrorList.add(ann);
    }
 else {
      Element annotationElement=annotationType.asElement();
      if (!IGNORED_ANNOTATIONS.contains(annotationElement.getSimpleName().toString())) {
        if (hasStereotype(annotationElement,stereotypes)) {
          annotationMirrorList.add(ann);
        }
      }
    }
  }
  if (element instanceof ExecutableElement && annotationMirrorList.isEmpty()) {
    ExecutableElement executableElement=(ExecutableElement)element;
    if (findAnnotation(element,Override.class) != null) {
      ExecutableElement overridden=findOverriddenMethod(executableElement);
      if (overridden != null) {
        return findAnnotationsWithStereotype(overridden,stereotypes);
      }
    }
  }
  return annotationMirrorList.toArray(new AnnotationMirror[annotationMirrorList.size()]);
}