Program: 160521
Project: 160521
Buggy source:
@Override public void fixInverseMismatches(){
  for (  IfcRelContainedInSpatialStructure ifcRelContainedInSpatialStructure : getAll(IfcRelContainedInSpatialStructure.class)) {
    for (    IfcProduct ifcProduct : ifcRelContainedInSpatialStructure.getRelatedElements()) {
      if (ifcProduct instanceof IfcElement) {
        IfcElement ifcElement=(IfcElement)ifcProduct;
        ifcElement.getContainedInStructure().add(ifcRelContainedInSpatialStructure);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void fixInverseMismatches(){
  for (  IfcRelContainedInSpatialStructure ifcRelContainedInSpatialStructure : getAll(IfcRelContainedInSpatialStructure.class)) {
    for (    IfcProduct ifcProduct : ifcRelContainedInSpatialStructure.getRelatedElements()) {
      if (ifcProduct instanceof IfcElement) {
        IfcElement ifcElement=(IfcElement)ifcProduct;
        ifcElement.getContainedInStructure().add(ifcRelContainedInSpatialStructure);
      }
 else       if (ifcProduct instanceof IfcAnnotation) {
        IfcAnnotation ifcAnnotation=(IfcAnnotation)ifcProduct;
        ifcAnnotation.getContainedInStructure().add(ifcRelContainedInSpatialStructure);
      }
 else       if (ifcProduct instanceof IfcGrid) {
        IfcGrid ifcGrid=(IfcGrid)ifcProduct;
        ifcGrid.getContainedInStructure().add(ifcRelContainedInSpatialStructure);
      }
    }
  }
  for (  IfcPresentationLayerAssignment ifcPresentationLayerAssignment : getAllWithSubTypes(IfcPresentationLayerAssignment.class)) {
    for (    IfcLayeredItem ifcLayeredItem : ifcPresentationLayerAssignment.getAssignedItems()) {
      if (ifcLayeredItem instanceof IfcRepresentation) {
        IfcRepresentation ifcRepresentation=(IfcRepresentation)ifcLayeredItem;
        ifcRepresentation.getLayerAssignments().add(ifcPresentationLayerAssignment);
      }
 else       if (ifcLayeredItem instanceof IfcRepresentationItem) {
        IfcRepresentationItem ifcRepresentationItem=(IfcRepresentationItem)ifcLayeredItem;
        ifcRepresentationItem.getLayerAssignments().add(ifcPresentationLayerAssignment);
      }
    }
  }
  for (  IfcRelAssociates ifcRelAssociates : getAllWithSubTypes(IfcRelAssociates.class)) {
    for (    IfcRoot ifcRoot : ifcRelAssociates.getRelatedObjects()) {
      if (ifcRoot instanceof IfcObjectDefinition) {
        ((IfcObjectDefinition)ifcRoot).getHasAssociations().add(ifcRelAssociates);
      }
 else       if (ifcRoot instanceof IfcPropertyDefinition) {
        ((IfcPropertyDefinition)ifcRoot).getHasAssociations().add(ifcRelAssociates);
      }
    }
  }
  for (  IfcTerminatorSymbol ifcTerminatorSymbol : getAllWithSubTypes(IfcTerminatorSymbol.class)) {
    IfcAnnotationCurveOccurrence ifcAnnotationCurveOccurrence=ifcTerminatorSymbol.getAnnotatedCurve();
    if (ifcAnnotationCurveOccurrence instanceof IfcDimensionCurve) {
      ((IfcDimensionCurve)ifcAnnotationCurveOccurrence).setItem(ifcTerminatorSymbol);
    }
  }
  for (  IfcRelReferencedInSpatialStructure ifcRelReferencedInSpatialStructure : getAllWithSubTypes(IfcRelReferencedInSpatialStructure.class)) {
    for (    IfcProduct ifcProduct : ifcRelReferencedInSpatialStructure.getRelatedElements()) {
      if (ifcProduct instanceof IfcElement) {
        ((IfcElement)ifcProduct).getReferencedInStructures().add(ifcRelReferencedInSpatialStructure);
      }
    }
  }
  for (  IfcProduct ifcProduct : getAllWithSubTypes(IfcProduct.class)) {
    IfcProductRepresentation ifcProductRepresentation=ifcProduct.getRepresentation();
    if (ifcProductRepresentation instanceof IfcProductDefinitionShape) {
      ((IfcProductDefinitionShape)ifcProductRepresentation).getShapeOfProduct().add(ifcProduct);
    }
  }
  for (  IfcRelConnectsStructuralActivity ifcRelConnectsStructuralActivity : getAllWithSubTypes(IfcRelConnectsStructuralActivity.class)) {
    IfcStructuralActivityAssignmentSelect ifcStructuralActivityAssignmentSelect=ifcRelConnectsStructuralActivity.getRelatingElement();
    if (ifcStructuralActivityAssignmentSelect instanceof IfcStructuralItem) {
      ((IfcStructuralItem)ifcStructuralActivityAssignmentSelect).getAssignedStructuralActivity().add(ifcRelConnectsStructuralActivity);
    }
  }
}