Program: 23736
Project: 23736
Buggy source:
public org.hl7.fhir.dstu2.model.Observation convertObservation(org.hl7.fhir.dstu3.model.Observation src) throws FHIRException {
  if (src == null)   return null;
  org.hl7.fhir.dstu2.model.Observation tgt=new org.hl7.fhir.dstu2.model.Observation();
  copyDomainResource(src,tgt);
  for (  org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier())   tgt.addIdentifier(convertIdentifier(t));
  tgt.setStatus(convertObservationStatus(src.getStatus()));
  for (  org.hl7.fhir.dstu3.model.CodeableConcept c : src.getCategory())   tgt.setCategory(convertCodeableConcept(c));
  tgt.setCode(convertCodeableConcept(src.getCode()));
  tgt.setSubject(convertReference(src.getSubject()));
  tgt.setEncounter(convertReference(src.getEncounter()));
  tgt.setEffective(convertType(src.getEffective()));
  tgt.setIssued(src.getIssued());
  for (  org.hl7.fhir.dstu3.model.Reference t : src.getPerformer())   tgt.addPerformer(convertReference(t));
  tgt.setValue(convertType(src.getValue()));
  tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason()));
  tgt.setInterpretation(convertCodeableConcept(src.getInterpretation()));
  tgt.setComments(src.getComment());
  tgt.setBodySite(convertCodeableConcept(src.getBodySite()));
  tgt.setMethod(convertCodeableConcept(src.getMethod()));
  tgt.setSpecimen(convertReference(src.getSpecimen()));
  tgt.setDevice(convertReference(src.getDevice()));
  for (  org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange())   tgt.addReferenceRange(convertObservationReferenceRangeComponent(t));
  for (  org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent t : src.getRelated())   tgt.addRelated(convertObservationRelatedComponent(t));
  for (  org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent t : src.getComponent())   tgt.addComponent(convertObservationComponentComponent(t));
  return tgt;
}

Fixed version (ground truth):
public org.hl7.fhir.dstu2.model.Observation convertObservation(org.hl7.fhir.dstu3.model.Observation src) throws FHIRException {
  if (src == null || src.isEmpty())   return null;
  org.hl7.fhir.dstu2.model.Observation tgt=new org.hl7.fhir.dstu2.model.Observation();
  copyDomainResource(src,tgt);
  for (  org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier())   tgt.addIdentifier(convertIdentifier(t));
  tgt.setStatus(convertObservationStatus(src.getStatus()));
  for (  org.hl7.fhir.dstu3.model.CodeableConcept c : src.getCategory())   tgt.setCategory(convertCodeableConcept(c));
  tgt.setCode(convertCodeableConcept(src.getCode()));
  tgt.setSubject(convertReference(src.getSubject()));
  tgt.setEncounter(convertReference(src.getEncounter()));
  tgt.setEffective(convertType(src.getEffective()));
  tgt.setIssued(src.getIssued());
  for (  org.hl7.fhir.dstu3.model.Reference t : src.getPerformer())   tgt.addPerformer(convertReference(t));
  tgt.setValue(convertType(src.getValue()));
  tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason()));
  tgt.setInterpretation(convertCodeableConcept(src.getInterpretation()));
  tgt.setComments(src.getComment());
  tgt.setBodySite(convertCodeableConcept(src.getBodySite()));
  tgt.setMethod(convertCodeableConcept(src.getMethod()));
  tgt.setSpecimen(convertReference(src.getSpecimen()));
  tgt.setDevice(convertReference(src.getDevice()));
  for (  org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange())   tgt.addReferenceRange(convertObservationReferenceRangeComponent(t));
  for (  org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent t : src.getRelated())   tgt.addRelated(convertObservationRelatedComponent(t));
  for (  org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent t : src.getComponent())   tgt.addComponent(convertObservationComponentComponent(t));
  return tgt;
}