Program: 91326
Project: 91326
Buggy source:
/** 
 * Compare two sequences and identify a list of edits between them.
 * @param < S > type of sequence being compared.
 * @param cmp the comparator supplying the element equivalence function.
 * @param a the first (also known as old or pre-image) sequence. Edits returned by this algorithm will reference indexes using the 'A' side:  {@link Edit#getBeginA()},   {@link Edit#getEndA()}.
 * @param b the second (also known as new or post-image) sequence. Edits returned by this algorithm will reference indexes using the 'B' side:  {@link Edit#getBeginB()},   {@link Edit#getEndB()}.
 * @return a modifiable edit list comparing the two sequences. If empty, thesequences are identical according to  {@code cmp}'s rules. The result list is never null.
 */
public <S extends Sequence>EditList diff(SequenceComparator<? super S> cmp,S a,S b){
  Edit region=cmp.reduceCommonStartEnd(a,b,coverEdit(a,b));
switch (region.getType()) {
case INSERT:
case DELETE:
    return EditList.singleton(region);
case REPLACE:
{
    SubsequenceComparator<S> cs=new SubsequenceComparator<S>(cmp);
    Subsequence<S> as=Subsequence.a(a,region);
    Subsequence<S> bs=Subsequence.b(b,region);
    EditList e=Subsequence.toBase(diffNonCommon(cs,as,bs),as,bs);
    Edit last=e.get(e.size() - 1);
    if (last.getType() == Edit.Type.INSERT) {
      while (last.endB < b.size() && cmp.equals(b,last.beginB,b,region.endB)) {
        last.beginA++;
        last.endA++;
        last.beginB++;
        last.endB++;
      }
    }
    return e;
  }
case EMPTY:
return new EditList(0);
default :
throw new IllegalStateException();
}
}

Fixed version (ground truth):
/** 
 * Compare two sequences and identify a list of edits between them.
 * @param < S > type of sequence being compared.
 * @param cmp the comparator supplying the element equivalence function.
 * @param a the first (also known as old or pre-image) sequence. Edits returned by this algorithm will reference indexes using the 'A' side:  {@link Edit#getBeginA()},   {@link Edit#getEndA()}.
 * @param b the second (also known as new or post-image) sequence. Edits returned by this algorithm will reference indexes using the 'B' side:  {@link Edit#getBeginB()},   {@link Edit#getEndB()}.
 * @return a modifiable edit list comparing the two sequences. If empty, thesequences are identical according to  {@code cmp}'s rules. The result list is never null.
 */
public <S extends Sequence>EditList diff(SequenceComparator<? super S> cmp,S a,S b){
  Edit region=cmp.reduceCommonStartEnd(a,b,coverEdit(a,b));
switch (region.getType()) {
case INSERT:
case DELETE:
    return EditList.singleton(region);
case REPLACE:
{
    SubsequenceComparator<S> cs=new SubsequenceComparator<S>(cmp);
    Subsequence<S> as=Subsequence.a(a,region);
    Subsequence<S> bs=Subsequence.b(b,region);
    EditList e=Subsequence.toBase(diffNonCommon(cs,as,bs),as,bs);
    Edit last=e.get(e.size() - 1);
    if (last.getType() == Edit.Type.INSERT) {
      while (last.endB < b.size() && cmp.equals(b,last.beginB,b,last.endB)) {
        last.beginA++;
        last.endA++;
        last.beginB++;
        last.endB++;
      }
    }
    return e;
  }
case EMPTY:
return new EditList(0);
default :
throw new IllegalStateException();
}
}