Program: 64808
Project: 64808
Buggy source:
public XMLCompositeCollectionMapping generateCompositeCollectionMapping(Property property,XMLDescriptor descriptor,NamespaceInfo namespaceInfo,String referenceClassName){
  XMLCompositeCollectionMapping mapping=new XMLCompositeCollectionMapping();
  mapping.setAttributeName(property.getPropertyName());
  initializeXMLContainerMapping(mapping);
  if (property.isSetReadOnly()) {
    mapping.setIsReadOnly(property.isReadOnly());
  }
  if (property.isSetWriteOnly()) {
    mapping.setIsWriteOnly(property.isWriteOnly());
  }
  if (property.isMethodProperty()) {
    if (property.getGetMethodName() == null) {
      String paramTypeAsString=property.getType().getName();
      mapping.setAttributeAccessor(new JAXBSetMethodAttributeAccessor(paramTypeAsString,helper.getClassLoader()));
      mapping.setIsReadOnly(true);
      mapping.setSetMethodName(property.getSetMethodName());
    }
 else     if (property.getSetMethodName() == null) {
      mapping.setGetMethodName(property.getGetMethodName());
      mapping.setIsWriteOnly(true);
    }
 else {
      mapping.setSetMethodName(property.getSetMethodName());
      mapping.setGetMethodName(property.getGetMethodName());
    }
  }
  if (property.isSetNullPolicy()) {
    mapping.setNullPolicy(getNullPolicyFromProperty(property,namespaceInfo.getNamespaceResolverForDescriptor()));
  }
 else   if (property.isNillable()) {
    mapping.getNullPolicy().setNullRepresentedByXsiNil(true);
    mapping.getNullPolicy().setMarshalNullRepresentation(XMLNullRepresentationType.XSI_NIL);
  }
  if (property.isSetXmlElementWrapper()) {
    mapping.setWrapperNullPolicy(getWrapperNullPolicyFromProperty(property));
  }
  JavaClass collectionType=property.getType();
  if (collectionType.isArray()) {
    JAXBArrayAttributeAccessor accessor=new JAXBArrayAttributeAccessor(mapping.getAttributeAccessor(),mapping.getContainerPolicy(),helper.getClassLoader());
    JavaClass componentType=collectionType.getComponentType();
    if (componentType.isArray()) {
      Class adaptedClass=classToGeneratedClasses.get(componentType.getName());
      referenceClassName=adaptedClass.getName();
      accessor.setAdaptedClassName(referenceClassName);
      JavaClass baseComponentType=getBaseComponentType(componentType);
      if (baseComponentType.isPrimitive()) {
        Class primitiveClass=XMLConversionManager.getDefaultManager().convertClassNameToClass(baseComponentType.getRawName());
        accessor.setComponentClass(primitiveClass);
      }
 else {
        accessor.setComponentClassName(baseComponentType.getQualifiedName());
      }
    }
 else {
      accessor.setComponentClassName(componentType.getQualifiedName());
    }
    mapping.setAttributeAccessor(accessor);
  }
  collectionType=containerClassImpl(collectionType);
  mapping.useCollectionClassName(collectionType.getRawName());
  XMLField xmlField=getXPathForField(property,namespaceInfo,false);
  mapping.setXPath(xmlField.getXPath());
  if (referenceClassName == null) {
    ((XMLField)mapping.getField()).setIsTypedTextField(true);
    ((XMLField)mapping.getField()).setSchemaType(XMLConstants.ANY_TYPE_QNAME);
  }
 else {
    mapping.setReferenceClassName(referenceClassName);
  }
  if (property.isRequired()) {
    ((XMLField)mapping.getField()).setRequired(true);
  }
  if (property.getInverseReferencePropertyName() != null) {
    mapping.setContainerAttributeName(property.getInverseReferencePropertyName());
    JavaClass backPointerPropertyType=null;
    JavaClass referenceClass=property.getActualType();
    if (property.getInverseReferencePropertyGetMethodName() != null && property.getInverseReferencePropertySetMethodName() != null && !property.getInverseReferencePropertyGetMethodName().equals("String_Node_Str") && !property.getInverseReferencePropertySetMethodName().equals("String_Node_Str")) {
      mapping.setContainerGetMethodName(property.getInverseReferencePropertySetMethodName());
      mapping.setContainerSetMethodName(property.getInverseReferencePropertySetMethodName());
      JavaMethod getMethod=referenceClass.getDeclaredMethod(mapping.getContainerGetMethodName(),new JavaClass[]{});
      if (getMethod != null) {
        backPointerPropertyType=getMethod.getReturnType();
      }
    }
 else {
      JavaField backpointerField=referenceClass.getDeclaredField(property.getInverseReferencePropertyName());
      if (backpointerField != null) {
        backPointerPropertyType=backpointerField.getResolvedType();
      }
    }
    if (isCollectionType(backPointerPropertyType)) {
      mapping.getInverseReferenceMapping().setContainerPolicy(ContainerPolicy.buildDefaultPolicy());
    }
  }
  return mapping;
}

Fixed version (ground truth):
public XMLCompositeCollectionMapping generateCompositeCollectionMapping(Property property,XMLDescriptor descriptor,JavaClass javaClass,NamespaceInfo namespaceInfo,String referenceClassName){
  XMLCompositeCollectionMapping mapping=new XMLCompositeCollectionMapping();
  mapping.setAttributeName(property.getPropertyName());
  initializeXMLContainerMapping(mapping);
  JavaClass manyValueJavaClass=helper.getJavaClass(ManyValue.class);
  if (manyValueJavaClass.isAssignableFrom(javaClass)) {
    mapping.setReuseContainer(false);
  }
  if (property.isSetReadOnly()) {
    mapping.setIsReadOnly(property.isReadOnly());
  }
  if (property.isSetWriteOnly()) {
    mapping.setIsWriteOnly(property.isWriteOnly());
  }
  if (property.isMethodProperty()) {
    if (property.getGetMethodName() == null) {
      String paramTypeAsString=property.getType().getName();
      mapping.setAttributeAccessor(new JAXBSetMethodAttributeAccessor(paramTypeAsString,helper.getClassLoader()));
      mapping.setIsReadOnly(true);
      mapping.setSetMethodName(property.getSetMethodName());
    }
 else     if (property.getSetMethodName() == null) {
      mapping.setGetMethodName(property.getGetMethodName());
      mapping.setIsWriteOnly(true);
    }
 else {
      mapping.setSetMethodName(property.getSetMethodName());
      mapping.setGetMethodName(property.getGetMethodName());
    }
  }
  if (property.isSetNullPolicy()) {
    mapping.setNullPolicy(getNullPolicyFromProperty(property,namespaceInfo.getNamespaceResolverForDescriptor()));
  }
 else   if (property.isNillable()) {
    mapping.getNullPolicy().setNullRepresentedByXsiNil(true);
    mapping.getNullPolicy().setMarshalNullRepresentation(XMLNullRepresentationType.XSI_NIL);
  }
  if (property.isSetXmlElementWrapper()) {
    mapping.setWrapperNullPolicy(getWrapperNullPolicyFromProperty(property));
  }
  JavaClass collectionType=property.getType();
  if (collectionType.isArray()) {
    JAXBArrayAttributeAccessor accessor=new JAXBArrayAttributeAccessor(mapping.getAttributeAccessor(),mapping.getContainerPolicy(),helper.getClassLoader());
    JavaClass componentType=collectionType.getComponentType();
    if (componentType.isArray()) {
      Class adaptedClass=classToGeneratedClasses.get(componentType.getName());
      referenceClassName=adaptedClass.getName();
      accessor.setAdaptedClassName(referenceClassName);
      JavaClass baseComponentType=getBaseComponentType(componentType);
      if (baseComponentType.isPrimitive()) {
        Class primitiveClass=XMLConversionManager.getDefaultManager().convertClassNameToClass(baseComponentType.getRawName());
        accessor.setComponentClass(primitiveClass);
      }
 else {
        accessor.setComponentClassName(baseComponentType.getQualifiedName());
      }
    }
 else {
      accessor.setComponentClassName(componentType.getQualifiedName());
    }
    mapping.setAttributeAccessor(accessor);
  }
  collectionType=containerClassImpl(collectionType);
  mapping.useCollectionClassName(collectionType.getRawName());
  XMLField xmlField=getXPathForField(property,namespaceInfo,false);
  mapping.setXPath(xmlField.getXPath());
  if (referenceClassName == null) {
    ((XMLField)mapping.getField()).setIsTypedTextField(true);
    ((XMLField)mapping.getField()).setSchemaType(XMLConstants.ANY_TYPE_QNAME);
  }
 else {
    mapping.setReferenceClassName(referenceClassName);
  }
  if (property.isRequired()) {
    ((XMLField)mapping.getField()).setRequired(true);
  }
  if (property.getInverseReferencePropertyName() != null) {
    mapping.setContainerAttributeName(property.getInverseReferencePropertyName());
    JavaClass backPointerPropertyType=null;
    JavaClass referenceClass=property.getActualType();
    if (property.getInverseReferencePropertyGetMethodName() != null && property.getInverseReferencePropertySetMethodName() != null && !property.getInverseReferencePropertyGetMethodName().equals("String_Node_Str") && !property.getInverseReferencePropertySetMethodName().equals("String_Node_Str")) {
      mapping.setContainerGetMethodName(property.getInverseReferencePropertySetMethodName());
      mapping.setContainerSetMethodName(property.getInverseReferencePropertySetMethodName());
      JavaMethod getMethod=referenceClass.getDeclaredMethod(mapping.getContainerGetMethodName(),new JavaClass[]{});
      if (getMethod != null) {
        backPointerPropertyType=getMethod.getReturnType();
      }
    }
 else {
      JavaField backpointerField=referenceClass.getDeclaredField(property.getInverseReferencePropertyName());
      if (backpointerField != null) {
        backPointerPropertyType=backpointerField.getResolvedType();
      }
    }
    if (isCollectionType(backPointerPropertyType)) {
      mapping.getInverseReferenceMapping().setContainerPolicy(ContainerPolicy.buildDefaultPolicy());
    }
  }
  return mapping;
}