Program: 64829
Project: 64829
Buggy source:
/** 
 * Set an XmlAdapter on this Property.  The type, generic type and  original type will be set as required based on the XmlAdapter's marshal method return type and input parameters.
 * @param adapterCls
 */
public void setAdapterClass(JavaClass adapterCls){
  adapterClass=adapterCls;
  JavaClass newType=helper.getJavaClass(Object.class);
  ArrayList<JavaMethod> marshalMethods=new ArrayList<JavaMethod>();
  for (Iterator<JavaMethod> methodIt=adapterClass.getMethods().iterator(); methodIt.hasNext(); ) {
    JavaMethod method=methodIt.next();
    if (method.getName().equals(MARSHAL_METHOD_NAME)) {
      JavaClass returnType=method.getReturnType();
      if (!returnType.getQualifiedName().equals(newType.getQualifiedName())) {
        if (!returnType.isInterface()) {
          newType=(JavaClass)method.getReturnType();
          setTypeFromAdapterClass(newType,method.getParameterTypes()[0]);
          return;
        }
      }
      marshalMethods.add(method);
    }
  }
  if (marshalMethods.size() == 0) {
    setTypeFromAdapterClass(newType,null);
    return;
  }
  for (  JavaMethod method : marshalMethods) {
    JavaClass paramType=method.getParameterTypes()[0];
    if (!paramType.getQualifiedName().equals(newType.getQualifiedName())) {
      setTypeFromAdapterClass(newType,paramType);
      return;
    }
  }
  setTypeFromAdapterClass(newType,marshalMethods.get(0).getParameterTypes()[0]);
}

Fixed version (ground truth):
/** 
 * Set an XmlAdapter on this Property.  The type, generic type and  original type will be set as required based on the XmlAdapter's marshal method return type and input parameters.
 * @param adapterCls
 */
public void setAdapterClass(JavaClass adapterCls){
  adapterClass=adapterCls;
  Type genericSuperClass=adapterCls.getGenericSuperclass();
  while (genericSuperClass != null && genericSuperClass instanceof Class) {
    genericSuperClass=((Class)genericSuperClass).getGenericSuperclass();
  }
  if (genericSuperClass != null) {
    ParameterizedType parameterizedSuperClass=(ParameterizedType)genericSuperClass;
    Type[] typeArguments=parameterizedSuperClass.getActualTypeArguments();
    Type valueType=typeArguments[0];
    Type boundType=typeArguments.length > 1 ? typeArguments[1] : typeArguments[0];
    setTypeFromAdapterClass(getJavaClassFromType(valueType),getJavaClassFromType(boundType));
    return;
  }
  JavaClass newType=helper.getJavaClass(Object.class);
  ArrayList<JavaMethod> marshalMethods=new ArrayList<JavaMethod>();
  for (Iterator<JavaMethod> methodIt=adapterClass.getMethods().iterator(); methodIt.hasNext(); ) {
    JavaMethod method=methodIt.next();
    if (method.getName().equals(MARSHAL_METHOD_NAME)) {
      JavaClass returnType=method.getReturnType();
      if (!returnType.getQualifiedName().equals(newType.getQualifiedName())) {
        if (!returnType.isInterface()) {
          newType=(JavaClass)method.getReturnType();
          setTypeFromAdapterClass(newType,method.getParameterTypes()[0]);
          return;
        }
      }
      marshalMethods.add(method);
    }
  }
  if (marshalMethods.size() == 0) {
    setTypeFromAdapterClass(newType,null);
    return;
  }
  for (  JavaMethod method : marshalMethods) {
    JavaClass paramType=method.getParameterTypes()[0];
    if (!paramType.getQualifiedName().equals(newType.getQualifiedName())) {
      setTypeFromAdapterClass(newType,paramType);
      return;
    }
  }
  setTypeFromAdapterClass(newType,marshalMethods.get(0).getParameterTypes()[0]);
}