Program: 61488
Project: 61488
Buggy source:
/** 
 * Method that finds all combination of variables mappings Ex: if var 'a' can be mapped to a1 and a2, and var 'b' to b1 and b2, the method return all combinations (a1,b1), (a2,b1), (a1,b2), (a2,b2) It calculates at most 'maxVarCombination', where
 * @param mappedVars map of variables (out-of-scope) and candidate replacements of
 * @param varsNamesToCombine names of all variables (out of scope)
 * @param indexVar current variable under analysis
 * @param currentCombination current combination of variables
 * @param allCombinations list that store all variable combinations
 */
public static void findAllVarMappingCombination(Map<VarAccessWrapper,List<CtVariable>> mappedVars,List<VarAccessWrapper> varsNamesToCombine,int indexVar,Map<String,CtVariable> currentCombination,List<Map<String,CtVariable>> allCombinations){
  if (varsNamesToCombine.size() == indexVar) {
    allCombinations.add(currentCombination);
    return;
  }
  VarAccessWrapper currentVar=varsNamesToCombine.get(indexVar);
  List<CtVariable> mapped=mappedVars.get(currentVar);
  if (currentCombination.containsKey(currentVar.getVar().getVariable().getSimpleName())) {
    findAllVarMappingCombination(mappedVars,varsNamesToCombine,indexVar + 1,currentCombination,allCombinations);
  }
 else {
    int numberCombination=0;
    for (    CtVariable varFromMap : mapped) {
      Map<String,CtVariable> newCombination=new TreeMap<>(currentCombination);
      newCombination.put(currentVar.getVar().getVariable().getSimpleName(),varFromMap);
      findAllVarMappingCombination(mappedVars,varsNamesToCombine,indexVar + 1,newCombination,allCombinations);
      numberCombination++;
      if (numberCombination == ConfigurationProperties.getPropertyInt("String_Node_Str")) {
        break;
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Method that finds all combination of variables mappings Ex: if var 'a' can be mapped to a1 and a2, and var 'b' to b1 and b2, the method return all combinations (a1,b1), (a2,b1), (a1,b2), (a2,b2)
 * @param mappedVars map of variables (out-of-scope) and candidate replacements of
 * @return
 */
public static List<Map<String,CtVariable>> findAllVarMappingCombination(Map<VarAccessWrapper,List<CtVariable>> mappedVars){
  if (mappedVars.isEmpty()) {
    return new ArrayList<Map<String,CtVariable>>();
  }
  List<VarAccessWrapper> varsNamesToCombine=new ArrayList<>(mappedVars.keySet());
  List<Map<String,CtVariable>> allCombinations=new ArrayList<>();
  allCombinations.add(new TreeMap<>());
  int maxNumberCombinations=ConfigurationProperties.getPropertyInt("String_Node_Str");
  int numberTotalComb=1;
  int max=-1;
  for (  VarAccessWrapper currentVar : varsNamesToCombine) {
    List<CtVariable> mapped=mappedVars.get(currentVar);
    int numberCompVar=mapped.size();
    if (numberCompVar > max)     max=numberCompVar;
    logger.debug("String_Node_Str".format("String_Node_Str",currentVar.getVar().getVariable().getSimpleName(),numberCompVar));
    numberTotalComb*=numberCompVar;
  }
  double maxPerVar=Math.pow(numberTotalComb,1.0 / varsNamesToCombine.size());
  double maxPerVarLimit=Math.pow(maxNumberCombinations,1.0 / varsNamesToCombine.size());
  logger.debug("String_Node_Str".format("String_Node_Str",maxPerVar,maxPerVarLimit));
  int partialAnalyzed=0;
  for (  VarAccessWrapper currentVar : varsNamesToCombine) {
    List<Map<String,CtVariable>> generationCombinations=new ArrayList<>();
    List<CtVariable> mapped=mappedVars.get(currentVar);
    for (    CtVariable varFromMap : mapped) {
      int varsAnalyzed=0;
      for (      Map<String,CtVariable> previousCombination : allCombinations) {
        Map<String,CtVariable> newCombination=new TreeMap<>(previousCombination);
        newCombination.put(currentVar.getVar().getVariable().getSimpleName(),varFromMap);
        generationCombinations.add(newCombination);
        varsAnalyzed++;
        if (varsAnalyzed > maxPerVarLimit) {
          break;
        }
      }
    }
    allCombinations=generationCombinations;
  }
  allCombinations=allCombinations.stream().filter(e -> !e.isEmpty()).collect(Collectors.toList());
  logger.debug("String_Node_Str" + allCombinations.size());
  return allCombinations;
}