Program: 23331
Project: 23331
Buggy source:
public org.hl7.fhir.dstu2.model.ElementDefinition convertElementDefinition(org.hl7.fhir.dstu3.model.ElementDefinition src) throws FHIRException {
  if (src == null || src.isEmpty())   return null;
  org.hl7.fhir.dstu2.model.ElementDefinition tgt=new org.hl7.fhir.dstu2.model.ElementDefinition();
  copyElement(src,tgt);
  tgt.setPath(src.getPath());
  for (  org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation> t : src.getRepresentation())   tgt.addRepresentation(convertPropertyRepresentation(t.getValue()));
  if (src.hasSliceName())   tgt.setName(src.getSliceName());
 else   tgt.setName(src.getId());
  tgt.setLabel(src.getLabel());
  for (  org.hl7.fhir.dstu3.model.Coding t : src.getCode())   tgt.addCode(convertCoding(t));
  tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing()));
  tgt.setShort(src.getShort());
  tgt.setDefinition(src.getDefinition());
  tgt.setComments(src.getComments());
  tgt.setRequirements(src.getRequirements());
  for (  org.hl7.fhir.dstu3.model.StringType t : src.getAlias())   tgt.addAlias(t.getValue());
  tgt.setMin(src.getMin());
  tgt.setMax(src.getMax());
  tgt.setBase(convertElementDefinitionBaseComponent(src.getBase()));
  if (src.hasContentReference())   tgt.setNameReference(src.getContentReference().substring(1));
  for (  org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent t : src.getType())   tgt.addType(convertTypeRefComponent(t));
  tgt.setDefaultValue(convertType(src.getDefaultValue()));
  tgt.setMeaningWhenMissing(src.getMeaningWhenMissing());
  tgt.setFixed(convertType(src.getFixed()));
  tgt.setPattern(convertType(src.getPattern()));
  tgt.setExample(convertType(src.getExample()));
  tgt.setMinValue(convertType(src.getMinValue()));
  tgt.setMaxValue(convertType(src.getMaxValue()));
  tgt.setMaxLength(src.getMaxLength());
  for (  org.hl7.fhir.dstu3.model.IdType t : src.getCondition())   tgt.addCondition(t.getValue());
  for (  org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint())   tgt.addConstraint(convertElementDefinitionConstraintComponent(t));
  tgt.setMustSupport(src.getMustSupport());
  tgt.setIsModifier(src.getIsModifier());
  tgt.setIsSummary(src.getIsSummary());
  tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding()));
  for (  org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping())   tgt.addMapping(convertElementDefinitionMappingComponent(t));
  return tgt;
}

Fixed version (ground truth):
public org.hl7.fhir.dstu2.model.ElementDefinition convertElementDefinition(org.hl7.fhir.dstu3.model.ElementDefinition src) throws FHIRException {
  if (src == null || src.isEmpty())   return null;
  org.hl7.fhir.dstu2.model.ElementDefinition tgt=new org.hl7.fhir.dstu2.model.ElementDefinition();
  copyElement(src,tgt);
  tgt.setPath(src.getPath());
  for (  org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation> t : src.getRepresentation())   tgt.addRepresentation(convertPropertyRepresentation(t.getValue()));
  if (src.hasSliceName())   tgt.setName(src.getSliceName());
 else   tgt.setName(src.getId());
  tgt.setLabel(src.getLabel());
  for (  org.hl7.fhir.dstu3.model.Coding t : src.getCode())   tgt.addCode(convertCoding(t));
  if (src.hasSlicing())   tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing()));
  tgt.setShort(src.getShort());
  tgt.setDefinition(src.getDefinition());
  tgt.setComments(src.getComments());
  tgt.setRequirements(src.getRequirements());
  for (  org.hl7.fhir.dstu3.model.StringType t : src.getAlias())   tgt.addAlias(t.getValue());
  tgt.setMin(src.getMin());
  tgt.setMax(src.getMax());
  if (src.hasBase())   tgt.setBase(convertElementDefinitionBaseComponent(src.getBase()));
  if (src.hasContentReference())   tgt.setNameReference(src.getContentReference().substring(1));
  for (  org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent t : src.getType())   tgt.addType(convertTypeRefComponent(t));
  tgt.setDefaultValue(convertType(src.getDefaultValue()));
  tgt.setMeaningWhenMissing(src.getMeaningWhenMissing());
  tgt.setFixed(convertType(src.getFixed()));
  tgt.setPattern(convertType(src.getPattern()));
  tgt.setExample(convertType(src.getExample()));
  tgt.setMinValue(convertType(src.getMinValue()));
  tgt.setMaxValue(convertType(src.getMaxValue()));
  tgt.setMaxLength(src.getMaxLength());
  for (  org.hl7.fhir.dstu3.model.IdType t : src.getCondition())   tgt.addCondition(t.getValue());
  for (  org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint())   tgt.addConstraint(convertElementDefinitionConstraintComponent(t));
  tgt.setMustSupport(src.getMustSupport());
  tgt.setIsModifier(src.getIsModifier());
  tgt.setIsSummary(src.getIsSummary());
  if (src.hasBinding())   tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding()));
  for (  org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping())   tgt.addMapping(convertElementDefinitionMappingComponent(t));
  return tgt;
}