Program: 32669
Project: 32669
Buggy source:
/** 
 * Sorts the blocks of the specified list of changes. This ensures that the user iterating the list of change blocks can view changes in increasing order. This ensures that indices will not be shifted. <p>This performs a bubble sort, swapping adjacent change blocks if they should be swapped. The bubble sort is used instead of a more efficient sort because it is necessary to adjust offsets when swapping and therefore it is preferred to only swap adjacent elements. Bubble sort is a sort that only swaps adjacent elements.
 * @param allowContradictingEvents whether a pair of contradicting events shallbe allowed. This would typically be an insert that is wiped away with a delete, an update that is wiped away with a delete, or an insert that is later updated.
 */
static void sortListEventBlocks(List<ListEventBlock> changes,boolean allowContradictingEvents){
  for (int i=0; i < changes.size() - 1; i++) {
    if (i < 0)     i=0;
    for (int j=i; j >= 0; ) {
      ListEventBlock first=changes.get(j);
      ListEventBlock second=changes.get(j + 1);
      if (blocksContradict(first,second)) {
        if (!allowContradictingEvents) {
          throw new IllegalStateException("String_Node_Str" + first + "String_Node_Str"+ second+ "String_Node_Str");
        }
        List<ListEventBlock> contradictingPair=changes.subList(j,j + 2);
        simplifyContradiction(contradictingPair);
        if (contradictingPair.size() == 0) {
          i-=2;
          break;
        }
 else         if (contradictingPair.size() == 1) {
          i-=1;
          j--;
        }
 else         if (contradictingPair.size() == 2) {
          j--;
        }
      }
 else       if (requiresSplit(first,second)) {
        ListEventBlock third=split(first,second);
        changes.add(j + 2,third);
        j++;
      }
 else       if (canBeCombined(first,second)) {
        combine(first,second);
        changes.remove(j + 1);
        i--;
        j--;
      }
 else       if (requiresSwap(first,second)) {
        shift(first,second);
        changes.set(j,second);
        changes.set(j + 1,first);
        j--;
      }
 else {
        break;
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Sorts the blocks of the specified list of changes. This ensures that the user iterating the list of change blocks can view changes in increasing order. This ensures that indices will not be shifted. <p>This performs a bubble sort, swapping adjacent change blocks if they should be swapped. The bubble sort is used instead of a more efficient sort because it is necessary to adjust offsets when swapping and therefore it is preferred to only swap adjacent elements. Bubble sort is a sort that only swaps adjacent elements.
 * @param allowContradictingEvents whether a pair of contradicting events shallbe allowed. This would typically be an insert that is wiped away with a delete, an update that is wiped away with a delete, or an insert that is later updated.
 */
static void sortListEventBlocks(List<ListEventBlock> changes,boolean allowContradictingEvents){
  for (int i=0; i < changes.size() - 1; i++) {
    if (i < 0)     i=0;
    for (int j=i; j >= 0; ) {
      ListEventBlock first=changes.get(j);
      ListEventBlock second=changes.get(j + 1);
      if (blocksContradict(first,second)) {
        if (!allowContradictingEvents) {
          throw new IllegalStateException("String_Node_Str" + first + "String_Node_Str"+ second+ "String_Node_Str");
        }
        List<ListEventBlock> contradictingPair=changes.subList(j,j + 2);
        simplifyContradiction(contradictingPair);
        if (contradictingPair.size() == 0) {
          i-=2;
          break;
        }
 else         if (contradictingPair.size() == 1) {
          i-=1;
          j--;
        }
 else         if (contradictingPair.size() == 2) {
          i-=1;
          j--;
        }
      }
 else       if (requiresSplit(first,second)) {
        ListEventBlock third=split(first,second);
        changes.add(j + 2,third);
        j++;
      }
 else       if (canBeCombined(first,second)) {
        combine(first,second);
        changes.remove(j + 1);
        i--;
        j--;
      }
 else       if (requiresSwap(first,second)) {
        shift(first,second);
        changes.set(j,second);
        changes.set(j + 1,first);
        j--;
      }
 else {
        break;
      }
    }
  }
}