Program: 190621
Project: 190621
Buggy source:
/** 
 * Compute   {@link #types}.
 * @param last if true, every  {@link XmlElementRef} must yield at least one type.
 */
private void calcTypes(boolean last){
  XmlElementRef[] ann;
  types=new LinkedHashSet<Element<T,C>>();
  XmlElementRefs refs=seed.readAnnotation(XmlElementRefs.class);
  XmlElementRef ref=seed.readAnnotation(XmlElementRef.class);
  if (refs != null && ref != null) {
    parent.builder.reportError(new IllegalAnnotationException(Messages.MUTUALLY_EXCLUSIVE_ANNOTATIONS.format(nav().getClassName(parent.getClazz()) + '#' + seed.getName(),ref.annotationType().getName(),refs.annotationType().getName()),ref,refs));
  }
  if (refs != null)   ann=refs.value();
 else {
    if (ref != null)     ann=new XmlElementRef[]{ref};
 else     ann=null;
  }
  isRequired=!isCollection();
  if (ann != null) {
    Navigator<T,C,F,M> nav=nav();
    AnnotationReader<T,C,F,M> reader=reader();
    final T defaultType=nav.ref(XmlElementRef.DEFAULT.class);
    final C je=nav.asDecl(JAXBElement.class);
    for (    XmlElementRef r : ann) {
      boolean yield;
      T type=reader.getClassValue(r,"String_Node_Str");
      if (type.equals(defaultType))       type=nav.erasure(getIndividualType());
      if (nav.getBaseClass(type,je) != null)       yield=addGenericElement(r);
 else       yield=addAllSubtypes(type);
      if (isRequired && !isRequired(r))       isRequired=false;
      if (last && !yield) {
        if (type.equals(nav.ref(JAXBElement.class))) {
          parent.builder.reportError(new IllegalAnnotationException(Messages.NO_XML_ELEMENT_DECL.format(getEffectiveNamespaceFor(r),r.name()),this));
        }
 else {
          parent.builder.reportError(new IllegalAnnotationException(Messages.INVALID_XML_ELEMENT_REF.format(type),this));
        }
        return;
      }
    }
  }
  Iterator<PropertyInfoImpl<T,C,F,M>> i=subTypes.iterator();
  while (i.hasNext()) {
    ReferencePropertyInfoImpl<T,C,F,M> info=(ReferencePropertyInfoImpl<T,C,F,M>)i.next();
    PropertySeed sd=info.seed;
    refs=sd.readAnnotation(XmlElementRefs.class);
    ref=sd.readAnnotation(XmlElementRef.class);
    if (refs != null && ref != null) {
      parent.builder.reportError(new IllegalAnnotationException(Messages.MUTUALLY_EXCLUSIVE_ANNOTATIONS.format(nav().getClassName(parent.getClazz()) + '#' + seed.getName(),ref.annotationType().getName(),refs.annotationType().getName()),ref,refs));
    }
    if (refs != null) {
      ann=refs.value();
    }
 else {
      if (ref != null) {
        ann=new XmlElementRef[]{ref};
      }
 else {
        ann=null;
      }
    }
    if (ann != null) {
      Navigator<T,C,F,M> nav=nav();
      AnnotationReader<T,C,F,M> reader=reader();
      final T defaultType=nav.ref(XmlElementRef.DEFAULT.class);
      final C je=nav.asDecl(JAXBElement.class);
      for (      XmlElementRef r : ann) {
        boolean yield;
        T type=reader.getClassValue(r,"String_Node_Str");
        if (type.equals(defaultType)) {
          type=nav.erasure(getIndividualType());
        }
        if (nav.getBaseClass(type,je) != null) {
          yield=addGenericElement(r,info);
        }
 else {
          yield=addAllSubtypes(type);
        }
        if (last && !yield) {
          if (type.equals(nav.ref(JAXBElement.class))) {
            parent.builder.reportError(new IllegalAnnotationException(Messages.NO_XML_ELEMENT_DECL.format(getEffectiveNamespaceFor(r),r.name()),this));
          }
 else {
            parent.builder.reportError(new IllegalAnnotationException(Messages.INVALID_XML_ELEMENT_REF.format(),this));
          }
          return;
        }
      }
    }
  }
  types=Collections.unmodifiableSet(types);
}

Fixed version (ground truth):
/** 
 * Compute   {@link #types}.
 * @param last if true, every  {@link XmlElementRef} must yield at least one type.
 */
private void calcTypes(boolean last){
  XmlElementRef[] ann;
  types=new LinkedHashSet<Element<T,C>>();
  XmlElementRefs refs=seed.readAnnotation(XmlElementRefs.class);
  XmlElementRef ref=seed.readAnnotation(XmlElementRef.class);
  if (refs != null && ref != null) {
    parent.builder.reportError(new IllegalAnnotationException(Messages.MUTUALLY_EXCLUSIVE_ANNOTATIONS.format(nav().getClassName(parent.getClazz()) + '#' + seed.getName(),ref.annotationType().getName(),refs.annotationType().getName()),ref,refs));
  }
  if (refs != null)   ann=refs.value();
 else {
    if (ref != null)     ann=new XmlElementRef[]{ref};
 else     ann=null;
  }
  isRequired=!isCollection();
  if (ann != null) {
    Navigator<T,C,F,M> nav=nav();
    AnnotationReader<T,C,F,M> reader=reader();
    final T defaultType=nav.ref(XmlElementRef.DEFAULT.class);
    final C je=nav.asDecl(JAXBElement.class);
    for (    XmlElementRef r : ann) {
      boolean yield;
      T type=reader.getClassValue(r,"String_Node_Str");
      if (nav().isSameType(type,defaultType))       type=nav.erasure(getIndividualType());
      if (nav.getBaseClass(type,je) != null)       yield=addGenericElement(r);
 else       yield=addAllSubtypes(type);
      if (isRequired && !isRequired(r))       isRequired=false;
      if (last && !yield) {
        if (nav().isSameType(type,nav.ref(JAXBElement.class))) {
          parent.builder.reportError(new IllegalAnnotationException(Messages.NO_XML_ELEMENT_DECL.format(getEffectiveNamespaceFor(r),r.name()),this));
        }
 else {
          parent.builder.reportError(new IllegalAnnotationException(Messages.INVALID_XML_ELEMENT_REF.format(type),this));
        }
        return;
      }
    }
  }
  Iterator<PropertyInfoImpl<T,C,F,M>> i=subTypes.iterator();
  while (i.hasNext()) {
    ReferencePropertyInfoImpl<T,C,F,M> info=(ReferencePropertyInfoImpl<T,C,F,M>)i.next();
    PropertySeed sd=info.seed;
    refs=sd.readAnnotation(XmlElementRefs.class);
    ref=sd.readAnnotation(XmlElementRef.class);
    if (refs != null && ref != null) {
      parent.builder.reportError(new IllegalAnnotationException(Messages.MUTUALLY_EXCLUSIVE_ANNOTATIONS.format(nav().getClassName(parent.getClazz()) + '#' + seed.getName(),ref.annotationType().getName(),refs.annotationType().getName()),ref,refs));
    }
    if (refs != null) {
      ann=refs.value();
    }
 else {
      if (ref != null) {
        ann=new XmlElementRef[]{ref};
      }
 else {
        ann=null;
      }
    }
    if (ann != null) {
      Navigator<T,C,F,M> nav=nav();
      AnnotationReader<T,C,F,M> reader=reader();
      final T defaultType=nav.ref(XmlElementRef.DEFAULT.class);
      final C je=nav.asDecl(JAXBElement.class);
      for (      XmlElementRef r : ann) {
        boolean yield;
        T type=reader.getClassValue(r,"String_Node_Str");
        if (nav().isSameType(type,defaultType)) {
          type=nav.erasure(getIndividualType());
        }
        if (nav.getBaseClass(type,je) != null) {
          yield=addGenericElement(r,info);
        }
 else {
          yield=addAllSubtypes(type);
        }
        if (last && !yield) {
          if (nav().isSameType(type,nav.ref(JAXBElement.class))) {
            parent.builder.reportError(new IllegalAnnotationException(Messages.NO_XML_ELEMENT_DECL.format(getEffectiveNamespaceFor(r),r.name()),this));
          }
 else {
            parent.builder.reportError(new IllegalAnnotationException(Messages.INVALID_XML_ELEMENT_REF.format(),this));
          }
          return;
        }
      }
    }
  }
  types=Collections.unmodifiableSet(types);
}