Program: 34408
Project: 34408
Buggy source:
private void wrapList(CodeStyle.WrapStyle wrapStyle,boolean align,boolean prependSpace,JavaTokenId separator,boolean wrapAfterSeparator,List<? extends Tree> trees){
  boolean first=true;
  int alignIndent=-1;
  boolean spaceBeforeSeparator, spaceAfterSeparator;
switch (separator) {
case COMMA:
    spaceBeforeSeparator=cs.spaceBeforeComma();
  spaceAfterSeparator=cs.spaceAfterComma();
break;
case SEMICOLON:
spaceBeforeSeparator=cs.spaceBeforeSemi();
spaceAfterSeparator=cs.spaceAfterSemi();
break;
default :
spaceBeforeSeparator=spaceAfterSeparator=cs.spaceAroundBinaryOps();
break;
}
for (Iterator<? extends Tree> it=trees.iterator(); it.hasNext(); ) {
Tree impl=it.next();
if (wrapAnnotation && impl.getKind() == Tree.Kind.ANNOTATION) {
wrapTree(CodeStyle.WrapStyle.WRAP_ALWAYS,alignIndent,spaceAfterSeparator ? 1 : 0,impl);
}
 else if (impl.getKind() == Tree.Kind.ERRONEOUS) {
scan(impl,null);
}
 else if (first) {
int index=tokens.index();
int c=col;
Diff d=diffs.isEmpty() ? null : diffs.getFirst();
spaces(prependSpace ? 1 : 0,true);
if (align) alignIndent=col;
if (wrapStyle == CodeStyle.WrapStyle.WRAP_NEVER || c <= indent()) {
scan(impl,null);
}
 else {
int o=tokens.offset();
WrapAbort oldCheckWrap=checkWrap;
checkWrap=new WrapAbort(o);
try {
scan(impl,null);
}
 catch (WrapAbort wa) {
}
 finally {
checkWrap=oldCheckWrap;
}
if (col > rightMargin && o >= lastNewLineOffset) {
rollback(index,c,d);
newline();
if (align) alignIndent=col;
scan(impl,null);
}
}
}
 else if (wrapAfterSeparator) {
boolean containedNewLine=spaces(spaceBeforeSeparator ? 1 : 0,false);
if (separator.equals(accept(separator)) && containedNewLine) {
newline();
}
wrapTree(wrapStyle,alignIndent,spaceAfterSeparator ? 1 : 0,impl);
}
 else {
wrapOperatorAndTree(wrapStyle,alignIndent,spaceAfterSeparator ? 1 : 0,impl);
}
first=false;
}
}

Fixed version (ground truth):
private void wrapList(CodeStyle.WrapStyle wrapStyle,boolean align,boolean prependSpace,JavaTokenId separator,boolean wrapAfterSeparator,List<? extends Tree> trees){
  boolean first=true;
  int alignIndent=-1;
  boolean spaceBeforeSeparator, spaceAfterSeparator;
switch (separator) {
case COMMA:
    spaceBeforeSeparator=cs.spaceBeforeComma();
  spaceAfterSeparator=cs.spaceAfterComma();
break;
case SEMICOLON:
spaceBeforeSeparator=cs.spaceBeforeSemi();
spaceAfterSeparator=cs.spaceAfterSemi();
break;
default :
spaceBeforeSeparator=spaceAfterSeparator=cs.spaceAroundBinaryOps();
break;
}
for (Iterator<? extends Tree> it=trees.iterator(); it.hasNext(); ) {
Tree impl=it.next();
if (wrapAnnotation && impl.getKind() == Tree.Kind.ANNOTATION) {
if (!first) {
boolean containedNewLine=spaces(spaceBeforeSeparator ? 1 : 0,false);
if (separator.equals(accept(separator)) && containedNewLine) {
newline();
}
}
wrapTree(CodeStyle.WrapStyle.WRAP_ALWAYS,alignIndent,spaceAfterSeparator ? 1 : 0,impl);
}
 else if (impl.getKind() == Tree.Kind.ERRONEOUS) {
scan(impl,null);
}
 else if (first) {
int index=tokens.index();
int c=col;
Diff d=diffs.isEmpty() ? null : diffs.getFirst();
spaces(prependSpace ? 1 : 0,true);
if (align) alignIndent=col;
if (wrapStyle == CodeStyle.WrapStyle.WRAP_NEVER || c <= indent()) {
scan(impl,null);
}
 else {
int o=tokens.offset();
WrapAbort oldCheckWrap=checkWrap;
checkWrap=new WrapAbort(o);
try {
scan(impl,null);
}
 catch (WrapAbort wa) {
}
 finally {
checkWrap=oldCheckWrap;
}
if (col > rightMargin && o >= lastNewLineOffset) {
rollback(index,c,d);
newline();
if (align) alignIndent=col;
scan(impl,null);
}
}
}
 else if (wrapAfterSeparator) {
boolean containedNewLine=spaces(spaceBeforeSeparator ? 1 : 0,false);
if (separator.equals(accept(separator)) && containedNewLine) {
newline();
}
wrapTree(wrapStyle,alignIndent,spaceAfterSeparator ? 1 : 0,impl);
}
 else {
wrapOperatorAndTree(wrapStyle,alignIndent,spaceAfterSeparator ? 1 : 0,impl);
}
first=false;
}
}