Program: 66158
Project: 66158
Buggy source:
public XMLCompositeObjectMapping generateCompositeObjectMapping(Property property,XMLDescriptor descriptor,NamespaceInfo namespaceInfo,String referenceClassName){
  XMLCompositeObjectMapping mapping=new XMLCompositeObjectMapping();
  mapping.setAttributeName(property.getPropertyName());
  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.getXmlPath() != null) {
    mapping.setField(new XMLField(property.getXmlPath()));
  }
 else {
    mapping.setXPath(getXPathForField(property,namespaceInfo,false).getXPath());
  }
  if (property.isSetNullPolicy()) {
    mapping.setNullPolicy(getNullPolicyFromProperty(property,namespaceInfo.getNamespaceResolverForDescriptor()));
  }
 else   if (property.isNillable()) {
    mapping.getNullPolicy().setNullRepresentedByXsiNil(true);
  }
  if (referenceClassName == null) {
    ((XMLField)mapping.getField()).setIsTypedTextField(true);
    ((XMLField)mapping.getField()).setSchemaType(XMLConstants.ANY_TYPE_QNAME);
    String defaultValue=property.getDefaultValue();
    if (null != defaultValue) {
      mapping.setConverter(new DefaultElementConverter(defaultValue));
    }
  }
 else {
    mapping.setReferenceClassName(referenceClassName);
  }
  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());
    }
  }
  if (property.isRequired()) {
    ((XMLField)mapping.getField()).setRequired(true);
  }
  return mapping;
}

Fixed version (ground truth):
public XMLCompositeObjectMapping generateCompositeObjectMapping(Property property,XMLDescriptor descriptor,NamespaceInfo namespaceInfo,String referenceClassName){
  XMLCompositeObjectMapping mapping=new XMLCompositeObjectMapping();
  mapping.setAttributeName(property.getPropertyName());
  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.getXmlPath() != null) {
    mapping.setField(new XMLField(property.getXmlPath()));
  }
 else {
    mapping.setXPath(getXPathForField(property,namespaceInfo,false).getXPath());
  }
  if (property.isSetNullPolicy()) {
    mapping.setNullPolicy(getNullPolicyFromProperty(property,namespaceInfo.getNamespaceResolverForDescriptor()));
  }
 else   if (property.isNillable()) {
    mapping.getNullPolicy().setNullRepresentedByXsiNil(true);
    if (property.isRequired()) {
      mapping.getNullPolicy().setMarshalNullRepresentation(XMLNullRepresentationType.XSI_NIL);
    }
  }
  if (referenceClassName == null) {
    ((XMLField)mapping.getField()).setIsTypedTextField(true);
    ((XMLField)mapping.getField()).setSchemaType(XMLConstants.ANY_TYPE_QNAME);
    String defaultValue=property.getDefaultValue();
    if (null != defaultValue) {
      mapping.setConverter(new DefaultElementConverter(defaultValue));
    }
  }
 else {
    mapping.setReferenceClassName(referenceClassName);
  }
  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());
    }
  }
  if (property.isRequired()) {
    ((XMLField)mapping.getField()).setRequired(true);
  }
  return mapping;
}