Program: 24926
Project: 24926
Buggy source:
public ScoringData transform(final ScoringData input){
  checkArgument(input.answerKey().isPresent() && input.systemOutput().isPresent(),"String_Node_Str" + "String_Node_Str");
  assertRealisIsNeutralized(input);
  final AnswerKey answerKey=input.answerKey().get();
  final SystemOutput systemOutput=input.systemOutput().get();
  final ImmutableMultimap<String,AssessedResponse> answerKeyByTypeRoleBaseFiller=Multimaps.index(filter(answerKey.annotatedResponses(),AssessedResponse.IsCorrectUpToInexactJustifications),Functions.compose(TypeRoleBaseFiller,AssessedResponse.Response));
  final ImmutableMultimap<String,AssessedResponse> answerKeyByTypeRole=Multimaps.index(filter(answerKey.annotatedResponses(),AssessedResponse.IsCorrectUpToInexactJustifications),Functions.compose(TypeRole,AssessedResponse.Response));
  final ImmutableMap.Builder<Response,Response> responseReplacements=ImmutableMap.builder();
  final ImmutableSet.Builder<Response> toDelete=ImmutableSet.builder();
  for (  final Response response : systemOutput.responses()) {
    final AssessedResponse assessedResponse=answerKey.assess(response).get();
    if (FieldAssessment.isAcceptable(assessedResponse.assessment().baseFillerCorrect()) && !FieldAssessment.isAcceptable(assessedResponse.assessment().entityCorrectFiller())) {
      final Collection<AssessedResponse> correctPoolResponsesSharingSameTypeRoleBF=answerKeyByTypeRoleBaseFiller.get(TypeRoleBaseFiller.apply(response));
      if (!correctPoolResponsesSharingSameTypeRoleBF.isEmpty()) {
        responseReplacements.put(response,Iterables.getFirst(correctPoolResponsesSharingSameTypeRoleBF,null).response());
        ++swappedCASForSameBF;
      }
 else {
        final Collection<AssessedResponse> correctPoolResponsesSharingSameTypeRole=answerKeyByTypeRole.get(TypeRole.apply(response));
        if (!correctPoolResponsesSharingSameTypeRole.isEmpty()) {
          responseReplacements.put(response,Iterables.getFirst(correctPoolResponsesSharingSameTypeRole,null).response());
          ++swappedCASDifferentBF;
        }
 else {
          toDelete.add(response);
          ++deleted;
        }
      }
    }
 else {
      ++passedThrough;
    }
  }
  final ResponseMapping responseMapping=ResponseMapping.create(responseReplacements.build(),toDelete.build());
  final ScoringData.Builder ret=input.modifiedCopy();
  ret.withSystemOutput(responseMapping.apply(systemOutput));
  if (input.systemLinking().isPresent()) {
    ret.withSystemLinking(responseMapping.apply(input.systemLinking().get()));
  }
  return ret.build();
}

Fixed version (ground truth):
public ScoringData transform(final ScoringData input){
  checkArgument(input.answerKey().isPresent() && input.systemOutput().isPresent(),"String_Node_Str" + "String_Node_Str");
  assertRealisIsNeutralized(input);
  final AnswerKey answerKey=input.answerKey().get();
  final SystemOutput systemOutput=input.systemOutput().get();
  final ImmutableMultimap<String,AssessedResponse> answerKeyByTypeRoleBaseFiller=Multimaps.index(filter(answerKey.annotatedResponses(),AssessedResponse.IsCorrectUpToInexactJustifications),Functions.compose(TypeRoleBaseFiller,AssessedResponse.Response));
  final ImmutableMultimap<String,AssessedResponse> answerKeyByTypeRole=Multimaps.index(filter(answerKey.annotatedResponses(),AssessedResponse.IsCorrectUpToInexactJustifications),Functions.compose(TypeRole,AssessedResponse.Response));
  final ImmutableMap.Builder<Response,Response> responseReplacements=ImmutableMap.builder();
  final ImmutableSet.Builder<Response> toDelete=ImmutableSet.builder();
  for (  final Response response : systemOutput.responses()) {
    final AssessedResponse assessedResponse=answerKey.assess(response).get();
    if (FieldAssessment.isAcceptable(assessedResponse.assessment().baseFillerCorrect()) && !FieldAssessment.isAcceptable(assessedResponse.assessment().entityCorrectFiller())) {
      final Collection<AssessedResponse> correctPoolResponsesSharingSameTypeRoleBF=answerKeyByTypeRoleBaseFiller.get(TypeRoleBaseFiller.apply(response));
      if (!correctPoolResponsesSharingSameTypeRoleBF.isEmpty()) {
        responseReplacements.put(response,Iterables.getFirst(correctPoolResponsesSharingSameTypeRoleBF,null).response());
        ++swappedCASForSameBF;
      }
 else {
        final Collection<AssessedResponse> correctPoolResponsesSharingSameTypeRole=answerKeyByTypeRole.get(TypeRole.apply(response));
        if (!correctPoolResponsesSharingSameTypeRole.isEmpty()) {
          responseReplacements.put(response,Iterables.getFirst(correctPoolResponsesSharingSameTypeRole,null).response());
          ++swappedCASDifferentBF;
        }
 else {
          toDelete.add(response);
          ++deleted;
        }
      }
    }
 else {
      ++passedThrough;
    }
  }
  final ResponseMapping responseMapping=ResponseMapping.create(responseReplacements.build(),toDelete.build());
  if (!responseMapping.isIdentity()) {
    log.info("String_Node_Str",responseMapping.summaryString());
  }
  final ScoringData.Builder ret=input.modifiedCopy();
  ret.withSystemOutput(responseMapping.apply(systemOutput));
  if (input.systemLinking().isPresent()) {
    ret.withSystemLinking(responseMapping.apply(input.systemLinking().get()));
  }
  return ret.build();
}