Program: 67006
Project: 67006
Buggy source:
/** 
 * Process any additional classes, such as inner classes, @XmlRegistry or from @XmlSeeAlso.
 * @param classes
 * @return
 */
private JavaClass[] processAdditionalClasses(JavaClass[] classes){
  ArrayList<JavaClass> extraClasses=new ArrayList<JavaClass>();
  ArrayList<JavaClass> classesToProcess=new ArrayList<JavaClass>();
  for (  JavaClass javaClass : classes) {
    if (areEquals(javaClass,byte[].class) || areEquals(javaClass,Byte[].class) || areEquals(javaClass,JAVAX_ACTIVATION_DATAHANDLER)) {
      if (this.globalElements == null) {
        globalElements=new HashMap<QName,ElementDeclaration>();
      }
      ElementDeclaration declaration=new ElementDeclaration(null,javaClass,javaClass.getQualifiedName(),false,XmlElementDecl.GLOBAL.class);
      globalElements.put(null,declaration);
    }
 else     if (javaClass.isArray()) {
      if (!helper.isBuiltInJavaType(javaClass.getComponentType())) {
        extraClasses.add(javaClass.getComponentType());
      }
      Class generatedClass=generateWrapperForArrayClass(javaClass);
      extraClasses.add(helper.getJavaClass(generatedClass));
      arrayClassesToGeneratedClasses.put(javaClass.getRawName(),generatedClass);
      generatedClassesToArrayClasses.put(generatedClass,javaClass);
    }
 else     if (isCollectionType(javaClass)) {
      JavaClass componentClass;
      if (javaClass.hasActualTypeArguments()) {
        componentClass=(JavaClass)javaClass.getActualTypeArguments().toArray()[0];
        if (!componentClass.isPrimitive()) {
          extraClasses.add(componentClass);
        }
      }
 else {
        componentClass=helper.getJavaClass(Object.class);
      }
      if (javaClassToType != null) {
        java.lang.reflect.Type theType=javaClassToType.get(javaClass);
        if (theType != null) {
          Class generatedClass=generateWrapperForArrayClass(javaClass);
          collectionClassesToGeneratedClasses.put(theType,generatedClass);
          generatedClassesToCollectionClasses.put(generatedClass,theType);
          extraClasses.add(helper.getJavaClass(generatedClass));
        }
      }
    }
 else     if (isMapType(javaClass)) {
      JavaClass keyClass;
      JavaClass valueClass;
      if (javaClass.hasActualTypeArguments()) {
        keyClass=(JavaClass)javaClass.getActualTypeArguments().toArray()[0];
        if (!helper.isBuiltInJavaType(keyClass)) {
          extraClasses.add(keyClass);
        }
        valueClass=(JavaClass)javaClass.getActualTypeArguments().toArray()[1];
        if (!helper.isBuiltInJavaType(valueClass)) {
          extraClasses.add(valueClass);
        }
      }
 else {
        keyClass=helper.getJavaClass(Object.class);
        valueClass=helper.getJavaClass(Object.class);
      }
      if (javaClassToType != null) {
        java.lang.reflect.Type theType=javaClassToType.get(javaClass);
        if (theType != null) {
          Class generatedClass=generateWrapperForMapClass(javaClass,keyClass,valueClass);
          collectionClassesToGeneratedClasses.put(theType,generatedClass);
          extraClasses.add(helper.getJavaClass(generatedClass));
        }
      }
    }
 else {
      processClass(javaClass,classesToProcess);
    }
  }
  for (  JavaClass javaClass : extraClasses) {
    processClass(javaClass,classesToProcess);
  }
  return classesToProcess.toArray(new JavaClass[classesToProcess.size()]);
}

Fixed version (ground truth):
/** 
 * Process any additional classes, such as inner classes, @XmlRegistry or from @XmlSeeAlso.
 * @param classes
 * @return
 */
private JavaClass[] processAdditionalClasses(JavaClass[] classes){
  ArrayList<JavaClass> extraClasses=new ArrayList<JavaClass>();
  ArrayList<JavaClass> classesToProcess=new ArrayList<JavaClass>();
  for (  JavaClass javaClass : classes) {
    if (areEquals(javaClass,byte[].class) || areEquals(javaClass,Byte[].class) || areEquals(javaClass,JAVAX_ACTIVATION_DATAHANDLER)) {
      if (this.globalElements == null) {
        globalElements=new HashMap<QName,ElementDeclaration>();
      }
      ElementDeclaration declaration=new ElementDeclaration(null,javaClass,javaClass.getQualifiedName(),false,XmlElementDecl.GLOBAL.class);
      globalElements.put(null,declaration);
    }
 else     if (javaClass.isArray()) {
      if (!helper.isBuiltInJavaType(javaClass.getComponentType())) {
        extraClasses.add(javaClass.getComponentType());
      }
      Class generatedClass=generateWrapperForArrayClass(javaClass);
      extraClasses.add(helper.getJavaClass(generatedClass));
      arrayClassesToGeneratedClasses.put(javaClass.getRawName(),generatedClass);
      generatedClassesToArrayClasses.put(generatedClass,javaClass);
    }
 else     if (isCollectionType(javaClass)) {
      JavaClass componentClass;
      if (javaClass.hasActualTypeArguments()) {
        componentClass=(JavaClass)javaClass.getActualTypeArguments().toArray()[0];
        if (!componentClass.isPrimitive()) {
          extraClasses.add(componentClass);
        }
      }
 else {
        componentClass=helper.getJavaClass(Object.class);
      }
      if (javaClassToType != null) {
        java.lang.reflect.Type theType=javaClassToType.get(javaClass);
        if (theType != null) {
          Class generatedClass=generateWrapperForArrayClass(javaClass);
          collectionClassesToGeneratedClasses.put(theType,generatedClass);
          generatedClassesToCollectionClasses.put(generatedClass,theType);
          extraClasses.add(helper.getJavaClass(generatedClass));
        }
      }
    }
 else     if (isMapType(javaClass)) {
      JavaClass keyClass;
      JavaClass valueClass;
      if (javaClass.hasActualTypeArguments()) {
        keyClass=(JavaClass)javaClass.getActualTypeArguments().toArray()[0];
        if (!helper.isBuiltInJavaType(keyClass)) {
          extraClasses.add(keyClass);
        }
        valueClass=(JavaClass)javaClass.getActualTypeArguments().toArray()[1];
        if (!helper.isBuiltInJavaType(valueClass)) {
          extraClasses.add(valueClass);
        }
      }
 else {
        keyClass=helper.getJavaClass(Object.class);
        valueClass=helper.getJavaClass(Object.class);
      }
      if (javaClassToType != null) {
        java.lang.reflect.Type theType=javaClassToType.get(javaClass);
        if (theType != null) {
          Class generatedClass=generateWrapperForMapClass(javaClass,keyClass,valueClass);
          collectionClassesToGeneratedClasses.put(theType,generatedClass);
          generatedClassesToCollectionClasses.put(generatedClass,theType);
          extraClasses.add(helper.getJavaClass(generatedClass));
        }
      }
    }
 else {
      processClass(javaClass,classesToProcess);
    }
  }
  for (  JavaClass javaClass : extraClasses) {
    processClass(javaClass,classesToProcess);
  }
  return classesToProcess.toArray(new JavaClass[classesToProcess.size()]);
}