nus-yam/ex-repair huggingface dataset:
Program: 61701
Project: 61701
Buggy source:
@Override public BufferedImage next(){
  if (!hasNext()) {
    return null;
  }
  return frameToImageGet(ftim,fframes.get(pos),0,null,0,ftim.displayRect,new Matrix(),new ColorTransform(),fbackgroundColor,false).getBufferedImage();
}

Fixed version (ground truth):
@Override public BufferedImage next(){
  if (!hasNext()) {
    return null;
  }
  return frameToImageGet(ftim,fframes.get(pos++),0,null,0,ftim.displayRect,new Matrix(),new ColorTransform(),fbackgroundColor,false).getBufferedImage();
}
Program: 61704
Project: 61704
Buggy source:
@Override public void translate(boolean isStatic,int scriptIndex,int classIndex,java.util.HashMap<Integer,GraphTargetItem> localRegs,Stack<GraphTargetItem> stack,java.util.Stack<GraphTargetItem> scopeStack,ConstantPool constants,AVM2Instruction ins,List<MethodInfo> method_info,List<GraphTargetItem> output,MethodBody body,ABC abc,HashMap<Integer,String> localRegNames,List<String> fullyQualifiedNames,String path,HashMap<Integer,Integer> localRegsAssignmentIps,int ip,HashMap<Integer,List<Integer>> refs,AVM2Code code){
  if (stack.size() > 0) {
    GraphTargetItem top=stack.pop();
    if (top instanceof CallPropertyAVM2Item) {
      output.add(top);
    }
 else     if (top instanceof CallSuperAVM2Item) {
      output.add(top);
    }
 else     if (top instanceof CallStaticAVM2Item) {
      output.add(top);
    }
 else     if (top instanceof CallMethodAVM2Item) {
      output.add(top);
    }
 else     if (top instanceof CallAVM2Item) {
      output.add(top);
    }
 else     if (top instanceof AssignmentAVM2Item) {
      output.add(top);
    }
  }
}

Fixed version (ground truth):
@Override public void translate(boolean isStatic,int scriptIndex,int classIndex,java.util.HashMap<Integer,GraphTargetItem> localRegs,Stack<GraphTargetItem> stack,java.util.Stack<GraphTargetItem> scopeStack,ConstantPool constants,AVM2Instruction ins,List<MethodInfo> method_info,List<GraphTargetItem> output,MethodBody body,ABC abc,HashMap<Integer,String> localRegNames,List<String> fullyQualifiedNames,String path,HashMap<Integer,Integer> localRegsAssignmentIps,int ip,HashMap<Integer,List<Integer>> refs,AVM2Code code){
  if (stack.size() > 0) {
    GraphTargetItem top=stack.pop();
    if (!(top instanceof IntegerValueAVM2Item)) {
      output.add(top);
    }
  }
}
Program: 61707
Project: 61707
Buggy source:
public AppDialog(){
  View.installEscapeCloseOperation(this);
  if (Configuration.useRibbonInterface.get()) {
    getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
  }
}

Fixed version (ground truth):
public AppDialog(Window owner){
  super(owner);
  View.installEscapeCloseOperation(this);
  if (Configuration.useRibbonInterface.get()) {
    getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
  }
}
Program: 61710
Project: 61710
Buggy source:
public SearchResultsDialog(String text,SearchListener<E> listener){
  setTitle(translate("String_Node_Str").replace("String_Node_Str",text));
  Container cnt=getContentPane();
  model=new DefaultListModel<>();
  resultsList=new JList<>(model);
  this.listener=listener;
  gotoButton.setActionCommand(ACTION_GOTO);
  gotoButton.addActionListener(this);
  closeButton.setActionCommand(ACTION_CANCEL);
  closeButton.addActionListener(this);
  JPanel buttonsPanel=new JPanel();
  buttonsPanel.setLayout(new FlowLayout());
  buttonsPanel.add(gotoButton);
  buttonsPanel.add(closeButton);
  resultsList.addMouseListener(new MouseAdapter(){
    @Override public void mouseClicked(    MouseEvent e){
      if (e.getClickCount() == 2) {
        gotoElement();
      }
    }
  }
);
  cnt.setLayout(new BorderLayout());
  JScrollPane sp=new JScrollPane(resultsList);
  sp.setPreferredSize(new Dimension(300,300));
  cnt.add(sp,BorderLayout.CENTER);
  cnt.add(buttonsPanel,BorderLayout.SOUTH);
  pack();
  setAlwaysOnTop(true);
  View.centerScreen(this);
  View.setWindowIcon(this);
}

Fixed version (ground truth):
public SearchResultsDialog(Window owner,String text,SearchListener<E> listener){
  super(owner);
  setTitle(translate("String_Node_Str").replace("String_Node_Str",text));
  Container cnt=getContentPane();
  model=new DefaultListModel<>();
  resultsList=new JList<>(model);
  this.listener=listener;
  gotoButton.setActionCommand(ACTION_GOTO);
  gotoButton.addActionListener(this);
  closeButton.setActionCommand(ACTION_CANCEL);
  closeButton.addActionListener(this);
  JPanel buttonsPanel=new JPanel();
  buttonsPanel.setLayout(new FlowLayout());
  buttonsPanel.add(gotoButton);
  buttonsPanel.add(closeButton);
  resultsList.addMouseListener(new MouseAdapter(){
    @Override public void mouseClicked(    MouseEvent e){
      if (e.getClickCount() == 2) {
        gotoElement();
      }
    }
  }
);
  cnt.setLayout(new BorderLayout());
  JScrollPane sp=new JScrollPane(resultsList);
  sp.setPreferredSize(new Dimension(300,300));
  cnt.add(sp,BorderLayout.CENTER);
  cnt.add(buttonsPanel,BorderLayout.SOUTH);
  pack();
  View.centerScreen(this);
  View.setWindowIcon(this);
}
Program: 61715
Project: 61715
Buggy source:
/** 
 * update the finder object with data from our UI
 */
private void updateFinder(){
  String regex=(String)jCmbFind.getSelectedItem();
  try {
    dsd.setPattern(regex,jChkRegex.isSelected(),jChkIgnoreCase.isSelected());
    ActionUtils.insertIntoCombo(jCmbFind,regex);
  }
 catch (  PatternSyntaxException e) {
    showRegexpError(e);
  }
}

Fixed version (ground truth):
/** 
 * update the finder object with data from our UI
 */
private void updateFinder(){
  String regex=(String)jCmbFind.getSelectedItem();
  try {
    dsd.setWrap(jChkWrap.isSelected());
    dsd.setPattern(regex,jChkRegex.isSelected(),jChkIgnoreCase.isSelected());
    ActionUtils.insertIntoCombo(jCmbFind,regex);
  }
 catch (  PatternSyntaxException e) {
    showRegexpError(e);
  }
}
Program: 61716
Project: 61716
Buggy source:
/** 
 * Creates new form FindDialog
 * @param text
 * @param dsd DocumentSerachData
 */
public ReplaceDialog(JTextComponent text,DocumentSearchData dsd){
  super(ActionUtils.getFrameFor(text),false);
  initComponents();
  textComponent=text;
  this.dsd=dsd;
  textComponent.addCaretListener(this);
  setLocationRelativeTo(text.getRootPane());
  getRootPane().setDefaultButton(jBtnNext);
  SwingUtils.addEscapeListener(this);
  jBtnReplaceAll.setEnabled(text.isEditable() && text.isEnabled());
}

Fixed version (ground truth):
/** 
 * Creates new form FindDialog
 * @param text
 * @param dsd DocumentSerachData
 */
public ReplaceDialog(JTextComponent text,DocumentSearchData dsd){
  super(ActionUtils.getFrameFor(text),false);
  initComponents();
  textComponent=text;
  this.dsd=dsd;
  textComponent.addCaretListener(this);
  setLocationRelativeTo(text.getRootPane());
  getRootPane().setDefaultButton(jBtnNext);
  SwingUtils.addEscapeListener(this);
  jBtnReplaceAll.setEnabled(text.isEditable() && text.isEnabled());
  jChkWrap.setSelected(dsd.isWrap());
}
Program: 61717
Project: 61717
Buggy source:
@Override public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData,SourceGenerator generator) throws CompilationException {
  if (!sceneBiasFlag && (frame instanceof DirectValueActionItem) && (((DirectValueActionItem)frame).value instanceof Long)) {
    return toSourceMerge(localData,generator,frame,new ActionGotoFrame((int)((long)(Long)((DirectValueActionItem)frame).value) - 1),playFlag ? new ActionPlay() : null);
  }
 else {
    return toSourceMerge(localData,generator,frame,new ActionGotoFrame2(playFlag,sceneBiasFlag,sceneBias));
  }
}

Fixed version (ground truth):
@Override public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData,SourceGenerator generator) throws CompilationException {
  if (!sceneBiasFlag && (frame instanceof DirectValueActionItem) && (((DirectValueActionItem)frame).value instanceof Long)) {
    return toSourceMerge(localData,generator,new ActionGotoFrame((int)((long)(Long)((DirectValueActionItem)frame).value) - 1),playFlag ? new ActionPlay() : null);
  }
 else {
    return toSourceMerge(localData,generator,frame,new ActionGotoFrame2(playFlag,sceneBiasFlag,sceneBias));
  }
}
Program: 61718
Project: 61718
Buggy source:
@Override public GraphTextWriter appendTo(GraphTextWriter writer,LocalData localData) throws InterruptedException {
  writer.append("String_Node_Str");
  writer.spaceBeforeCallParenthesies(1);
  writer.append("String_Node_Str");
  target.toString(writer,localData);
  writer.append("String_Node_Str").newLine();
  writer.append("String_Node_Str").newLine();
  writer.indent();
  for (  GraphTargetItem ti : commands) {
    ti.toString(writer,localData).newLine();
  }
  writer.unindent();
  return writer.append("String_Node_Str");
}

Fixed version (ground truth):
@Override public GraphTextWriter appendTo(GraphTextWriter writer,LocalData localData) throws InterruptedException {
  writer.append("String_Node_Str");
  writer.spaceBeforeCallParenthesies(1);
  writer.append("String_Node_Str");
  target.toString(writer,localData);
  writer.append("String_Node_Str").newLine();
  writer.append("String_Node_Str").newLine();
  writer.indent();
  for (  GraphTargetItem ti : commands) {
    ti.toStringSemicoloned(writer,localData).newLine();
  }
  writer.unindent();
  return writer.append("String_Node_Str");
}
Program: 61719
Project: 61719
Buggy source:
@Override public void translate(boolean isStatic,int scriptIndex,int classIndex,java.util.HashMap<Integer,GraphTargetItem> localRegs,Stack<GraphTargetItem> stack,java.util.Stack<GraphTargetItem> scopeStack,ConstantPool constants,AVM2Instruction ins,List<MethodInfo> method_info,List<GraphTargetItem> output,MethodBody body,ABC abc,HashMap<Integer,String> localRegNames,List<String> fullyQualifiedNames,String path,HashMap<Integer,Integer> localRegsAssignmentIps,int ip,HashMap<Integer,List<Integer>> refs,AVM2Code code){
  stack.push(new IntegerValueAVM2Item(ins,Long.valueOf(ins.operands[0])));
}

Fixed version (ground truth):
@Override public void translate(boolean isStatic,int scriptIndex,int classIndex,java.util.HashMap<Integer,GraphTargetItem> localRegs,Stack<GraphTargetItem> stack,java.util.Stack<GraphTargetItem> scopeStack,ConstantPool constants,AVM2Instruction ins,List<MethodInfo> method_info,List<GraphTargetItem> output,MethodBody body,ABC abc,HashMap<Integer,String> localRegNames,List<String> fullyQualifiedNames,String path,HashMap<Integer,Integer> localRegsAssignmentIps,int ip,HashMap<Integer,List<Integer>> refs,AVM2Code code){
  stack.push(new IntegerValueAVM2Item(ins,Long.valueOf((long)(short)ins.operands[0])));
}
Program: 61720
Project: 61720
Buggy source:
@Override public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData,SourceGenerator generator) throws CompilationException {
  AVM2Instruction ins=null;
  if (value >= 0 && value <= 255) {
    ins=new AVM2Instruction(0,new PushByteIns(),new int[]{(int)(long)value},new byte[0]);
  }
 else   if (value >= 0 && value <= 65535) {
    ins=new AVM2Instruction(0,new PushShortIns(),new int[]{(int)(long)value},new byte[0]);
  }
 else {
    ins=new AVM2Instruction(0,new PushIntIns(),new int[]{((AVM2SourceGenerator)generator).abc.constants.getIntId(value,true)},new byte[0]);
  }
  return toSourceMerge(localData,generator,ins);
}

Fixed version (ground truth):
@Override public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData,SourceGenerator generator) throws CompilationException {
  AVM2Instruction ins=null;
  if (value >= -128 && value <= 127) {
    ins=new AVM2Instruction(0,new PushByteIns(),new int[]{(int)(long)value},new byte[0]);
  }
 else   if (value >= -32768 && value <= 32767) {
    ins=new AVM2Instruction(0,new PushShortIns(),new int[]{((int)(long)value) & 0xffff},new byte[0]);
  }
 else {
    ins=new AVM2Instruction(0,new PushIntIns(),new int[]{((AVM2SourceGenerator)generator).abc.constants.getIntId(value,true)},new byte[0]);
  }
  return toSourceMerge(localData,generator,ins);
}
Program: 61721
Project: 61721
Buggy source:
@Override public List<GraphSourceItem> generate(SourceGeneratorLocalData localData,TypeItem item) throws CompilationException {
  String currentFullClassName=localData.currentClass == null ? null : (localData.pkg.isEmpty() ? localData.currentClass : localData.pkg + "String_Node_Str" + localData.currentClass);
  if (localData.documentClass && item.toString().equals(currentFullClassName)) {
    int slotId=0;
    int c=abc.findClassByName(currentFullClassName);
    for (    Trait t : localData.currentScript.traits.traits) {
      if (t instanceof TraitClass) {
        TraitClass tc=(TraitClass)t;
        if (tc.class_info == c) {
          slotId=tc.slot_id;
          break;
        }
      }
    }
    return GraphTargetItem.toSourceMerge(localData,this,ins(new GetGlobalScopeIns()),ins(new GetSlotIns(),slotId));
  }
 else {
    return GraphTargetItem.toSourceMerge(localData,this,ins(new GetLexIns(),resolveType(localData,item,abc,allABCs)));
  }
}

Fixed version (ground truth):
@Override public List<GraphSourceItem> generate(SourceGeneratorLocalData localData,TypeItem item) throws CompilationException {
  String currentFullClassName=localData.getFullClass();
  if (localData.documentClass && item.toString().equals(currentFullClassName)) {
    int slotId=0;
    int c=abc.findClassByName(currentFullClassName);
    for (    Trait t : localData.currentScript.traits.traits) {
      if (t instanceof TraitClass) {
        TraitClass tc=(TraitClass)t;
        if (tc.class_info == c) {
          slotId=tc.slot_id;
          break;
        }
      }
    }
    return GraphTargetItem.toSourceMerge(localData,this,ins(new GetGlobalScopeIns()),ins(new GetSlotIns(),slotId));
  }
 else {
    return GraphTargetItem.toSourceMerge(localData,this,ins(new GetLexIns(),resolveType(localData,item,abc,allABCs)));
  }
}
Program: 61727
Project: 61727
Buggy source:
/** 
 * Gets data bytes
 * @return Bytes of data
 */
@Override public byte[] getData(){
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  OutputStream os=baos;
  if (Configuration.debugCopy.get()) {
    os=new CopyOutputStream(os,new ByteArrayInputStream(super.data));
  }
  SWFOutputStream sos=new SWFOutputStream(os,getVersion());
  try {
    sos.writeUI16(spriteId);
    sos.writeUI16(frameCount);
    if (hasEndTag) {
      sos.writeUI16(0);
    }
    sos.close();
  }
 catch (  IOException e) {
  }
  return baos.toByteArray();
}

Fixed version (ground truth):
/** 
 * Gets data bytes
 * @return Bytes of data
 */
@Override public byte[] getData(){
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  OutputStream os=baos;
  if (Configuration.debugCopy.get()) {
    os=new CopyOutputStream(os,new ByteArrayInputStream(super.data));
  }
  SWFOutputStream sos=new SWFOutputStream(os,getVersion());
  try {
    sos.writeUI16(spriteId);
    sos.writeUI16(frameCount);
    sos.writeTags(subTags);
    if (hasEndTag) {
      sos.writeUI16(0);
    }
    sos.close();
  }
 catch (  IOException e) {
  }
  return baos.toByteArray();
}
Program: 61729
Project: 61729
Buggy source:
@Override public void translate(Stack<GraphTargetItem> stack,List<GraphTargetItem> output,java.util.HashMap<Integer,String> regNames,HashMap<String,GraphTargetItem> variables,HashMap<String,GraphTargetItem> functions,int staticOperation,String path){
  GraphTargetItem index=stack.pop();
  GraphTargetItem target=stack.pop();
  int indexInt=0;
  if (index instanceof DirectValueActionItem) {
    if (((DirectValueActionItem)index).value instanceof Long) {
      indexInt=(int)(long)(Long)((DirectValueActionItem)index).value;
    }
  }
  stack.push(new GetPropertyActionItem(this,target,indexInt));
}

Fixed version (ground truth):
@Override public void translate(Stack<GraphTargetItem> stack,List<GraphTargetItem> output,java.util.HashMap<Integer,String> regNames,HashMap<String,GraphTargetItem> variables,HashMap<String,GraphTargetItem> functions,int staticOperation,String path){
  GraphTargetItem index=stack.pop();
  GraphTargetItem target=stack.pop();
  int indexInt=0;
  if (index instanceof DirectValueActionItem) {
    if (((DirectValueActionItem)index).value instanceof Long) {
      indexInt=(int)(long)(Long)((DirectValueActionItem)index).value;
    }
 else     if (((DirectValueActionItem)index).value instanceof Double) {
      indexInt=(int)Math.round((Double)((DirectValueActionItem)index).value);
    }
 else     if (((DirectValueActionItem)index).value instanceof Float) {
      indexInt=(int)Math.round((Float)((DirectValueActionItem)index).value);
    }
  }
  stack.push(new GetPropertyActionItem(this,target,indexInt));
}
Program: 61732
Project: 61732
Buggy source:
public Multiname readMultiname() throws IOException {
  int kind=readU8();
  int namespace_index=-1;
  int name_index=-1;
  int namespace_set_index=-1;
  int qname_index=-1;
  List<Integer> params=new ArrayList<>();
  if ((kind == 7) || (kind == 0xd)) {
    namespace_index=readU30();
    name_index=readU30();
  }
 else   if ((kind == 0xf) || (kind == 0x10)) {
    name_index=readU30();
  }
 else   if ((kind == 0x11) || (kind == 0x12)) {
  }
 else   if ((kind == 9) || (kind == 0xe)) {
    name_index=readU30();
    namespace_set_index=readU30();
  }
 else   if ((kind == 0x1B) || (kind == 0x1C)) {
    namespace_set_index=readU30();
  }
 else   if (kind == 0x1D) {
    qname_index=readU30();
    int paramsLength=readU30();
    for (int i=0; i < paramsLength; i++) {
      params.add(readU30());
    }
  }
 else {
    throw new IOException("String_Node_Str" + Integer.toHexString(kind));
  }
  return new Multiname(kind,name_index,namespace_index,namespace_set_index,qname_index,params);
}

Fixed version (ground truth):
public Multiname readMultiname() throws IOException {
  int kind=readU8();
  int namespace_index=0;
  int name_index=0;
  int namespace_set_index=0;
  int qname_index=0;
  List<Integer> params=new ArrayList<>();
  if ((kind == Multiname.QNAME) || (kind == Multiname.QNAMEA)) {
    namespace_index=readU30();
    name_index=readU30();
  }
 else   if ((kind == Multiname.RTQNAME) || (kind == Multiname.RTQNAMEA)) {
    name_index=readU30();
  }
 else   if ((kind == Multiname.RTQNAMEL) || (kind == Multiname.RTQNAMELA)) {
  }
 else   if ((kind == Multiname.MULTINAME) || (kind == Multiname.MULTINAMEA)) {
    name_index=readU30();
    namespace_set_index=readU30();
  }
 else   if ((kind == Multiname.MULTINAMEL) || (kind == Multiname.MULTINAMELA)) {
    namespace_set_index=readU30();
  }
 else   if (kind == Multiname.TYPENAME) {
    qname_index=readU30();
    int paramsLength=readU30();
    for (int i=0; i < paramsLength; i++) {
      params.add(readU30());
    }
  }
 else {
    throw new IOException("String_Node_Str" + Integer.toHexString(kind));
  }
  return new Multiname(kind,name_index,namespace_index,namespace_set_index,qname_index,params);
}
Program: 61734
Project: 61734
Buggy source:
public static AVM2Instruction ins(InstructionDefinition def,int... operands){
  return new AVM2Instruction(0,def,operands,new byte[0]);
}

Fixed version (ground truth):
public static AVM2Instruction ins(InstructionDefinition def,Integer... operands){
  List<Integer> ops=new ArrayList<>();
  for (  Integer o : operands) {
    if (o != null) {
      ops.add(o);
    }
  }
  int opArr[]=new int[ops.size()];
  for (int i=0; i < ops.size(); i++) {
    opArr[i]=ops.get(i);
  }
  return new AVM2Instruction(0,def,opArr,new byte[0]);
}
Program: 61738
Project: 61738
Buggy source:
public ValueKind getValueKind(int nsKind,GraphTargetItem type,GraphTargetItem val){
  if (val instanceof BooleanAVM2Item) {
    BooleanAVM2Item bi=(BooleanAVM2Item)val;
    if (bi.value) {
      return new ValueKind(0,ValueKind.CONSTANT_True);
    }
 else {
      return new ValueKind(0,ValueKind.CONSTANT_False);
    }
  }
  boolean isNs=false;
  if (type instanceof NameAVM2Item) {
    if (((NameAVM2Item)type).getVariableName().equals("String_Node_Str")) {
      isNs=true;
    }
  }
  if ((type instanceof TypeItem) && (((TypeItem)type).fullTypeName.equals("String_Node_Str"))) {
    isNs=true;
  }
  if (val instanceof StringAVM2Item) {
    StringAVM2Item sval=(StringAVM2Item)val;
    if (isNs) {
      return new ValueKind(namespace(nsKind,sval.value),Namespace.KIND_NAMESPACE);
    }
 else {
      return new ValueKind(str(sval.value),ValueKind.CONSTANT_Utf8);
    }
  }
  if (val instanceof IntegerValueAVM2Item) {
    return new ValueKind(abc.constants.getIntId(((IntegerValueAVM2Item)val).value,true),ValueKind.CONSTANT_Int);
  }
  if (val instanceof FloatValueAVM2Item) {
    return new ValueKind(abc.constants.getIntId(((IntegerValueAVM2Item)val).value,true),ValueKind.CONSTANT_Double);
  }
  if (val instanceof NullAVM2Item) {
    return new ValueKind(0,ValueKind.CONSTANT_Null);
  }
  if (val instanceof UndefinedAVM2Item) {
    return new ValueKind(0,ValueKind.CONSTANT_Undefined);
  }
  return null;
}

Fixed version (ground truth):
public ValueKind getValueKind(int nsKind,GraphTargetItem type,GraphTargetItem val){
  if (val instanceof BooleanAVM2Item) {
    BooleanAVM2Item bi=(BooleanAVM2Item)val;
    if (bi.value) {
      return new ValueKind(0,ValueKind.CONSTANT_True);
    }
 else {
      return new ValueKind(0,ValueKind.CONSTANT_False);
    }
  }
  boolean isNs=false;
  if (type instanceof NameAVM2Item) {
    if (((NameAVM2Item)type).getVariableName().equals("String_Node_Str")) {
      isNs=true;
    }
  }
  if ((type instanceof TypeItem) && (((TypeItem)type).fullTypeName.equals("String_Node_Str"))) {
    isNs=true;
  }
  if (val instanceof StringAVM2Item) {
    StringAVM2Item sval=(StringAVM2Item)val;
    if (isNs) {
      return new ValueKind(namespace(nsKind,sval.value),Namespace.KIND_NAMESPACE);
    }
 else {
      return new ValueKind(str(sval.value),ValueKind.CONSTANT_Utf8);
    }
  }
  if (val instanceof IntegerValueAVM2Item) {
    return new ValueKind(abc.constants.getIntId(((IntegerValueAVM2Item)val).value,true),ValueKind.CONSTANT_Int);
  }
  if (val instanceof FloatValueAVM2Item) {
    return new ValueKind(abc.constants.getDoubleId(((FloatValueAVM2Item)val).value,true),ValueKind.CONSTANT_Double);
  }
  if (val instanceof NullAVM2Item) {
    return new ValueKind(0,ValueKind.CONSTANT_Null);
  }
  if (val instanceof UndefinedAVM2Item) {
    return new ValueKind(0,ValueKind.CONSTANT_Undefined);
  }
  return null;
}
Program: 61740
Project: 61740
Buggy source:
private int genNs(String custom,int namespace,List<Integer> openedNamespaces,SourceGeneratorLocalData localData){
  if (custom != null) {
    PropertyAVM2Item prop=new PropertyAVM2Item(null,custom,abc,allABCs,openedNamespaces,new ArrayList<MethodBody>());
    Reference<ValueKind> value=new Reference<>(null);
    prop.resolve(localData,new Reference<String>("String_Node_Str"),new Reference<String>("String_Node_Str"),new Reference<Integer>(0),value);
    namespace=value.getVal().value_index;
  }
  return namespace;
}

Fixed version (ground truth):
private int genNs(String pkg,String custom,int namespace,List<Integer> openedNamespaces,SourceGeneratorLocalData localData,int line) throws CompilationException {
  if (custom != null) {
    PropertyAVM2Item prop=new PropertyAVM2Item(null,custom,abc,allABCs,openedNamespaces,new ArrayList<MethodBody>());
    Reference<ValueKind> value=new Reference<>(null);
    prop.resolve(localData,new Reference<String>("String_Node_Str"),new Reference<String>("String_Node_Str"),new Reference<Integer>(0),value);
    boolean resolved=true;
    if (value.getVal() == null) {
      resolved=false;
    }
    if (!resolved) {
      throw new CompilationException("String_Node_Str",line);
    }
    namespace=value.getVal().value_index;
  }
  return namespace;
}
Program: 61743
Project: 61743
Buggy source:
private int genNs(String custom,int namespace,List<Integer> openedNamespaces,SourceGeneratorLocalData localData){
  if (custom != null) {
    PropertyAVM2Item prop=new PropertyAVM2Item(null,custom,null,abc,allABCs,openedNamespaces,new ArrayList<MethodBody>());
    Reference<ValueKind> value=new Reference<>(null);
    prop.resolve(localData,new Reference<String>("String_Node_Str"),new Reference<String>("String_Node_Str"),new Reference<Integer>(0),value);
    namespace=value.getVal().value_index;
  }
  return namespace;
}

Fixed version (ground truth):
private int genNs(String custom,int namespace,List<Integer> openedNamespaces,SourceGeneratorLocalData localData){
  if (custom != null) {
    PropertyAVM2Item prop=new PropertyAVM2Item(null,custom,abc,allABCs,openedNamespaces,new ArrayList<MethodBody>());
    Reference<ValueKind> value=new Reference<>(null);
    prop.resolve(localData,new Reference<String>("String_Node_Str"),new Reference<String>("String_Node_Str"),new Reference<Integer>(0),value);
    namespace=value.getVal().value_index;
  }
  return namespace;
}
Program: 61748
Project: 61748
Buggy source:
@Override public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData,SourceGenerator generator) throws CompilationException {
  return toSourceMerge(localData,generator,leftSide,rightSide,new AVM2Instruction(0,new AsTypeIns(),new int[]{},new byte[0]));
}

Fixed version (ground truth):
@Override public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData,SourceGenerator generator) throws CompilationException {
  return toSourceMerge(localData,generator,leftSide,rightSide,new AVM2Instruction(0,new AsTypeLateIns(),new int[]{},new byte[0]));
}
Program: 61749
Project: 61749
Buggy source:
@Override public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData,SourceGenerator generator) throws CompilationException {
  return toSourceMerge(localData,generator,leftSide,rightSide,new AVM2Instruction(0,new IsTypeIns(),new int[]{},new byte[0]));
}

Fixed version (ground truth):
@Override public List<GraphSourceItem> toSource(SourceGeneratorLocalData localData,SourceGenerator generator) throws CompilationException {
  return toSourceMerge(localData,generator,leftSide,rightSide,new AVM2Instruction(0,new IsTypeLateIns(),new int[]{},new byte[0]));
}
Program: 61751
Project: 61751
Buggy source:
public HasNext2Ins(){
  super(0x32,"String_Node_Str",new int[]{AVM2Code.OPT_U8,AVM2Code.OPT_U8});
}

Fixed version (ground truth):
public HasNext2Ins(){
  super(0x32,"String_Node_Str",new int[]{AVM2Code.DAT_LOCAL_REG_INDEX,AVM2Code.DAT_LOCAL_REG_INDEX});
}
Program: 61753
Project: 61753
Buggy source:
@Override public GraphTextWriter appendTo(GraphTextWriter writer,LocalData localData) throws InterruptedException {
  writer.append("String_Node_Str");
  scope.toString(writer,localData);
  writer.append("String_Node_Str").newLine();
  writer.append("String_Node_Str").newLine();
  writer.indent();
  writer.unindent();
  return writer.append("String_Node_Str");
}

Fixed version (ground truth):
@Override public GraphTextWriter appendTo(GraphTextWriter writer,LocalData localData) throws InterruptedException {
  writer.append("String_Node_Str");
  if (writer.getFormatting().spaceBeforeParenthesesWithParentheses) {
    writer.append("String_Node_Str");
  }
  writer.append("String_Node_Str");
  scope.toString(writer,localData);
  writer.append("String_Node_Str").newLine();
  writer.append("String_Node_Str").newLine();
  writer.indent();
  writer.unindent();
  return writer.append("String_Node_Str");
}
Program: 61754
Project: 61754
Buggy source:
@Override public GraphTextWriter appendTo(GraphTextWriter writer,LocalData localData) throws InterruptedException {
  if (writer instanceof NulWriter) {
    ((NulWriter)writer).startLoop(loop.id,LoopWithType.LOOP_TYPE_LOOP);
  }
  if (labelUsed) {
    writer.append("String_Node_Str" + loop.id + "String_Node_Str").newLine();
  }
  writer.append("String_Node_Str");
  expression.toString(writer,localData);
  writer.append("String_Node_Str").newLine();
  writer.append("String_Node_Str").newLine();
  writer.indent();
  for (  GraphTargetItem ti : commands) {
    if (!ti.isEmpty()) {
      ti.toStringSemicoloned(writer,localData).newLine();
    }
  }
  writer.unindent();
  writer.append("String_Node_Str");
  if (writer instanceof NulWriter) {
    LoopWithType loopOjb=((NulWriter)writer).endLoop(loop.id);
    labelUsed=loopOjb.used;
  }
  return writer;
}

Fixed version (ground truth):
@Override public GraphTextWriter appendTo(GraphTextWriter writer,LocalData localData) throws InterruptedException {
  if (writer instanceof NulWriter) {
    ((NulWriter)writer).startLoop(loop.id,LoopWithType.LOOP_TYPE_LOOP);
  }
  if (labelUsed) {
    writer.append("String_Node_Str" + loop.id + "String_Node_Str").newLine();
  }
  writer.append("String_Node_Str");
  if (writer.getFormatting().spaceBeforeParenthesesForEachParentheses) {
    writer.append("String_Node_Str");
  }
  writer.append("String_Node_Str");
  expression.toString(writer,localData);
  writer.append("String_Node_Str").newLine();
  writer.append("String_Node_Str").newLine();
  writer.indent();
  for (  GraphTargetItem ti : commands) {
    if (!ti.isEmpty()) {
      ti.toStringSemicoloned(writer,localData).newLine();
    }
  }
  writer.unindent();
  writer.append("String_Node_Str");
  if (writer instanceof NulWriter) {
    LoopWithType loopOjb=((NulWriter)writer).endLoop(loop.id);
    labelUsed=loopOjb.used;
  }
  return writer;
}
Program: 61755
Project: 61755
Buggy source:
@Override public GraphTextWriter appendTo(GraphTextWriter writer,LocalData localData) throws InterruptedException {
  if (writer instanceof NulWriter) {
    ((NulWriter)writer).startLoop(loop.id,LoopWithType.LOOP_TYPE_LOOP);
  }
  if (labelUsed) {
    writer.append("String_Node_Str" + loop.id + "String_Node_Str").newLine();
  }
  writer.append("String_Node_Str");
  expression.toString(writer,localData);
  writer.append("String_Node_Str").newLine();
  writer.append("String_Node_Str").newLine();
  writer.indent();
  for (  GraphTargetItem ti : commands) {
    if (!ti.isEmpty()) {
      ti.toStringSemicoloned(writer,localData).newLine();
    }
  }
  writer.unindent();
  writer.append("String_Node_Str");
  if (writer instanceof NulWriter) {
    LoopWithType loopOjb=((NulWriter)writer).endLoop(loop.id);
    labelUsed=loopOjb.used;
  }
  return writer;
}

Fixed version (ground truth):
@Override public GraphTextWriter appendTo(GraphTextWriter writer,LocalData localData) throws InterruptedException {
  if (writer instanceof NulWriter) {
    ((NulWriter)writer).startLoop(loop.id,LoopWithType.LOOP_TYPE_LOOP);
  }
  if (labelUsed) {
    writer.append("String_Node_Str" + loop.id + "String_Node_Str").newLine();
  }
  writer.append("String_Node_Str");
  if (writer.getFormatting().spaceBeforeParenthesesForParentheses) {
    writer.append("String_Node_Str");
  }
  writer.append("String_Node_Str");
  expression.toString(writer,localData);
  writer.append("String_Node_Str").newLine();
  writer.append("String_Node_Str").newLine();
  writer.indent();
  for (  GraphTargetItem ti : commands) {
    if (!ti.isEmpty()) {
      ti.toStringSemicoloned(writer,localData).newLine();
    }
  }
  writer.unindent();
  writer.append("String_Node_Str");
  if (writer instanceof NulWriter) {
    LoopWithType loopOjb=((NulWriter)writer).endLoop(loop.id);
    labelUsed=loopOjb.used;
  }
  return writer;
}
Program: 61756
Project: 61756
Buggy source:
public void convert(Trait parent,String path,List<ABCContainerTag> abcTags,ABC abc,boolean isStatic,ScriptExportMode exportMode,boolean makePackages,int scriptIndex,int classIndex,NulWriter writer,List<String> fullyQualifiedNames,boolean parallel) throws InterruptedException {
  if (!parallel || traits.size() < 2) {
    for (int t=0; t < traits.size(); t++) {
      TraitConvertTask task=new TraitConvertTask(traits.get(t),parent,makePackages,path,abcTags,abc,isStatic,exportMode,scriptIndex,classIndex,writer,fullyQualifiedNames,t,parallel);
      task.call();
    }
  }
 else {
    ExecutorService executor=Executors.newFixedThreadPool(Configuration.parallelThreadCount.get());
    List<Future<Void>> futureResults=null;
    futureResults=new ArrayList<>();
    for (int t=0; t < traits.size(); t++) {
      TraitConvertTask task=new TraitConvertTask(traits.get(t),parent,makePackages,path,abcTags,abc,isStatic,exportMode,scriptIndex,classIndex,writer,fullyQualifiedNames,t,parallel);
      Future<Void> future=executor.submit(task);
      futureResults.add(future);
    }
    for (int f=0; f < futureResults.size(); f++) {
      try {
        futureResults.get(f).get();
      }
 catch (      InterruptedException ex) {
        executor.shutdownNow();
        throw ex;
      }
catch (      ExecutionException ex) {
        Logger.getLogger(Traits.class.getName()).log(Level.SEVERE,"String_Node_Str",ex);
      }
    }
    executor.shutdown();
  }
}

Fixed version (ground truth):
public void convert(Trait parent,String path,List<ABCContainerTag> abcTags,ABC abc,boolean isStatic,ScriptExportMode exportMode,boolean makePackages,int scriptIndex,int classIndex,NulWriter writer,List<String> fullyQualifiedNames,boolean parallel) throws InterruptedException {
  if (!parallel || traits.size() < 2) {
    for (int t=0; t < traits.size(); t++) {
      TraitConvertTask task=new TraitConvertTask(traits.get(t),parent,makePackages,path,abcTags,abc,isStatic,exportMode,scriptIndex,classIndex,writer,fullyQualifiedNames,t,parallel);
      task.call();
    }
  }
 else {
    ExecutorService executor=Executors.newFixedThreadPool(Configuration.parallelThreadCount.get());
    List<Future<Void>> futureResults=null;
    futureResults=new ArrayList<>();
    for (int t=0; t < traits.size(); t++) {
      TraitConvertTask task=new TraitConvertTask(traits.get(t),parent,makePackages,path,abcTags,abc,isStatic,exportMode,scriptIndex,classIndex,new NulWriter(),fullyQualifiedNames,t,parallel);
      Future<Void> future=executor.submit(task);
      futureResults.add(future);
    }
    for (int f=0; f < futureResults.size(); f++) {
      try {
        futureResults.get(f).get();
      }
 catch (      InterruptedException ex) {
        executor.shutdownNow();
        throw ex;
      }
catch (      ExecutionException ex) {
        Logger.getLogger(Traits.class.getName()).log(Level.SEVERE,"String_Node_Str",ex);
      }
    }
    executor.shutdown();
  }
}
Program: 61757
Project: 61757
Buggy source:
@Override public GraphTextWriter appendTo(GraphTextWriter writer,LocalData localData) throws InterruptedException {
  if (writer instanceof NulWriter) {
    ((NulWriter)writer).startLoop(loop.id,LoopWithType.LOOP_TYPE_LOOP);
  }
  if (labelUsed) {
    writer.append("String_Node_Str" + loop.id + "String_Node_Str").newLine();
  }
  writer.append("String_Node_Str");
  if ((variableName instanceof DirectValueActionItem) && (((DirectValueActionItem)variableName).value instanceof RegisterNumber)) {
    writer.append("String_Node_Str");
  }
  stripQuotes(variableName,localData,writer);
  writer.append("String_Node_Str");
  enumVariable.toString(writer,localData);
  writer.append("String_Node_Str").startBlock();
  for (  GraphTargetItem ti : commands) {
    ti.toStringSemicoloned(writer,localData).newLine();
  }
  writer.endBlock();
  if (writer instanceof NulWriter) {
    LoopWithType loopOjb=((NulWriter)writer).endLoop(loop.id);
    labelUsed=loopOjb.used;
  }
  return writer;
}

Fixed version (ground truth):
@Override public GraphTextWriter appendTo(GraphTextWriter writer,LocalData localData) throws InterruptedException {
  if (writer instanceof NulWriter) {
    ((NulWriter)writer).startLoop(loop.id,LoopWithType.LOOP_TYPE_LOOP);
  }
  if (labelUsed) {
    writer.append("String_Node_Str" + loop.id + "String_Node_Str").newLine();
  }
  writer.append("String_Node_Str");
  if (writer.getFormatting().spaceBeforeParenthesesForParentheses) {
    writer.append("String_Node_Str");
  }
  writer.append("String_Node_Str");
  if ((variableName instanceof DirectValueActionItem) && (((DirectValueActionItem)variableName).value instanceof RegisterNumber)) {
    writer.append("String_Node_Str");
  }
  stripQuotes(variableName,localData,writer);
  writer.append("String_Node_Str");
  enumVariable.toString(writer,localData);
  writer.append("String_Node_Str").startBlock();
  for (  GraphTargetItem ti : commands) {
    ti.toStringSemicoloned(writer,localData).newLine();
  }
  writer.endBlock();
  if (writer instanceof NulWriter) {
    LoopWithType loopOjb=((NulWriter)writer).endLoop(loop.id);
    labelUsed=loopOjb.used;
  }
  return writer;
}
Program: 61758
Project: 61758
Buggy source:
@Override public GraphTextWriter appendTo(GraphTextWriter writer,LocalData localData) throws InterruptedException {
  writer.append("String_Node_Str").newLine();
  writer.append("String_Node_Str").newLine();
  writer.indent();
  for (  GraphTargetItem ti : tryCommands) {
    if (!ti.isEmpty()) {
      ti.toStringSemicoloned(writer,localData).newLine();
    }
  }
  writer.unindent();
  writer.append("String_Node_Str");
  for (int e=0; e < catchExceptions.size(); e++) {
    writer.newLine();
    writer.append("String_Node_Str");
    catchExceptions.get(e).toStringNoQuotes(writer,localData);
    writer.append("String_Node_Str").newLine();
    writer.append("String_Node_Str").newLine();
    writer.indent();
    List<GraphTargetItem> commands=catchCommands.get(e);
    for (    GraphTargetItem ti : commands) {
      if (!ti.isEmpty()) {
        ti.toStringSemicoloned(writer,localData).newLine();
      }
    }
    writer.unindent();
    writer.append("String_Node_Str");
  }
  if (finallyCommands.size() > 0) {
    writer.newLine();
    writer.append("String_Node_Str").newLine();
    writer.append("String_Node_Str").newLine();
    writer.indent();
    for (    GraphTargetItem ti : finallyCommands) {
      if (!ti.isEmpty()) {
        ti.toStringSemicoloned(writer,localData).newLine();
      }
    }
    writer.unindent();
    writer.append("String_Node_Str");
  }
  return writer;
}

Fixed version (ground truth):
@Override public GraphTextWriter appendTo(GraphTextWriter writer,LocalData localData) throws InterruptedException {
  writer.append("String_Node_Str").newLine();
  writer.append("String_Node_Str").newLine();
  writer.indent();
  for (  GraphTargetItem ti : tryCommands) {
    if (!ti.isEmpty()) {
      ti.toStringSemicoloned(writer,localData).newLine();
    }
  }
  writer.unindent();
  writer.append("String_Node_Str");
  for (int e=0; e < catchExceptions.size(); e++) {
    writer.newLine();
    writer.append("String_Node_Str");
    if (writer.getFormatting().spaceBeforeParenthesesCatchParentheses) {
      writer.append("String_Node_Str");
    }
    writer.append("String_Node_Str");
    catchExceptions.get(e).toStringNoQuotes(writer,localData);
    writer.append("String_Node_Str").newLine();
    writer.append("String_Node_Str").newLine();
    writer.indent();
    List<GraphTargetItem> commands=catchCommands.get(e);
    for (    GraphTargetItem ti : commands) {
      if (!ti.isEmpty()) {
        ti.toStringSemicoloned(writer,localData).newLine();
      }
    }
    writer.unindent();
    writer.append("String_Node_Str");
  }
  if (finallyCommands.size() > 0) {
    writer.newLine();
    writer.append("String_Node_Str").newLine();
    writer.append("String_Node_Str").newLine();
    writer.indent();
    for (    GraphTargetItem ti : finallyCommands) {
      if (!ti.isEmpty()) {
        ti.toStringSemicoloned(writer,localData).newLine();
      }
    }
    writer.unindent();
    writer.append("String_Node_Str");
  }
  return writer;
}
Program: 61759
Project: 61759
Buggy source:
@Override public GraphTextWriter appendTo(GraphTextWriter writer,LocalData localData) throws InterruptedException {
  writer.append("String_Node_Str");
  scope.toString(writer,localData);
  writer.append("String_Node_Str").newLine();
  writer.append("String_Node_Str").newLine();
  writer.indent();
  for (  GraphTargetItem ti : items) {
    ti.toString(writer,localData).newLine();
  }
  writer.unindent();
  return writer.append("String_Node_Str");
}

Fixed version (ground truth):
@Override public GraphTextWriter appendTo(GraphTextWriter writer,LocalData localData) throws InterruptedException {
  writer.append("String_Node_Str");
  if (writer.getFormatting().spaceBeforeParenthesesWithParentheses) {
    writer.append("String_Node_Str");
  }
  writer.append("String_Node_Str");
  scope.toString(writer,localData);
  writer.append("String_Node_Str").newLine();
  writer.append("String_Node_Str").newLine();
  writer.indent();
  for (  GraphTargetItem ti : items) {
    ti.toString(writer,localData).newLine();
  }
  writer.unindent();
  return writer.append("String_Node_Str");
}
Program: 61760
Project: 61760
Buggy source:
@Override public GraphTextWriter appendTo(GraphTextWriter writer,LocalData localData) throws InterruptedException {
  if (writer instanceof NulWriter) {
    ((NulWriter)writer).startLoop(loop.id,LoopWithType.LOOP_TYPE_LOOP);
  }
  if (labelUsed) {
    writer.append("String_Node_Str" + loop.id + "String_Node_Str").newLine();
  }
  writer.append("String_Node_Str");
  writer.startBlock();
  writer.indent();
  for (  GraphTargetItem ti : commands) {
    if (!ti.isEmpty()) {
      ti.toStringSemicoloned(writer,localData).newLine();
    }
  }
  writer.endBlock();
  writer.append("String_Node_Str");
  for (int i=0; i < expression.size(); i++) {
    if (expression.get(i).isEmpty()) {
      continue;
    }
    if (i != 0) {
      writer.append("String_Node_Str");
    }
    expression.get(i).toString(writer,localData);
  }
  writer.append("String_Node_Str").newLine();
  if (writer instanceof NulWriter) {
    LoopWithType loopOjb=((NulWriter)writer).endLoop(loop.id);
    labelUsed=loopOjb.used;
  }
  return writer;
}

Fixed version (ground truth):
@Override public GraphTextWriter appendTo(GraphTextWriter writer,LocalData localData) throws InterruptedException {
  if (writer instanceof NulWriter) {
    ((NulWriter)writer).startLoop(loop.id,LoopWithType.LOOP_TYPE_LOOP);
  }
  if (labelUsed) {
    writer.append("String_Node_Str" + loop.id + "String_Node_Str").newLine();
  }
  writer.append("String_Node_Str");
  writer.startBlock();
  for (  GraphTargetItem ti : commands) {
    if (!ti.isEmpty()) {
      ti.toStringSemicoloned(writer,localData).newLine();
    }
  }
  writer.endBlock().newLine();
  writer.append("String_Node_Str");
  if (writer.getFormatting().spaceBeforeParenthesesWhileParentheses) {
    writer.append("String_Node_Str");
  }
  writer.append("String_Node_Str");
  for (int i=0; i < expression.size(); i++) {
    if (expression.get(i).isEmpty()) {
      continue;
    }
    if (i != 0) {
      writer.append("String_Node_Str");
    }
    expression.get(i).toString(writer,localData);
  }
  writer.append("String_Node_Str").newLine();
  if (writer instanceof NulWriter) {
    LoopWithType loopOjb=((NulWriter)writer).endLoop(loop.id);
    labelUsed=loopOjb.used;
  }
  return writer;
}
Program: 61761
Project: 61761
Buggy source:
@Override public GraphTextWriter appendTo(GraphTextWriter writer,LocalData localData) throws InterruptedException {
  if (writer instanceof NulWriter) {
    ((NulWriter)writer).startLoop(loop.id,LoopWithType.LOOP_TYPE_LOOP);
  }
  if (labelUsed) {
    writer.append("String_Node_Str" + loop.id + "String_Node_Str").newLine();
  }
  writer.append("String_Node_Str");
  int p=0;
  for (int i=0; i < firstCommands.size(); i++) {
    if (firstCommands.get(i).isEmpty()) {
      continue;
    }
    if (p > 0) {
      writer.append("String_Node_Str");
    }
    firstCommands.get(i).toString(writer,localData);
    writer.stripSemicolon();
    p++;
  }
  writer.append("String_Node_Str");
  expression.toString(writer,localData);
  writer.append("String_Node_Str");
  p=0;
  for (int i=0; i < finalCommands.size(); i++) {
    if (finalCommands.get(i).isEmpty()) {
      continue;
    }
    if (p > 0) {
      writer.append("String_Node_Str");
    }
    finalCommands.get(i).toString(writer,localData);
    writer.stripSemicolon();
    p++;
  }
  writer.append("String_Node_Str").startBlock();
  for (  GraphTargetItem ti : commands) {
    if (!ti.isEmpty()) {
      ti.toStringSemicoloned(writer,localData).newLine();
    }
  }
  writer.endBlock();
  if (writer instanceof NulWriter) {
    LoopWithType loopOjb=((NulWriter)writer).endLoop(loop.id);
    labelUsed=loopOjb.used;
  }
  return writer;
}

Fixed version (ground truth):
@Override public GraphTextWriter appendTo(GraphTextWriter writer,LocalData localData) throws InterruptedException {
  if (writer instanceof NulWriter) {
    ((NulWriter)writer).startLoop(loop.id,LoopWithType.LOOP_TYPE_LOOP);
  }
  if (labelUsed) {
    writer.append("String_Node_Str" + loop.id + "String_Node_Str").newLine();
  }
  writer.append("String_Node_Str");
  if (writer.getFormatting().spaceBeforeParenthesesForParentheses) {
    writer.append("String_Node_Str");
  }
  writer.append("String_Node_Str");
  int p=0;
  for (int i=0; i < firstCommands.size(); i++) {
    if (firstCommands.get(i).isEmpty()) {
      continue;
    }
    if (p > 0) {
      writer.append("String_Node_Str");
    }
    firstCommands.get(i).toString(writer,localData);
    writer.stripSemicolon();
    p++;
  }
  writer.append("String_Node_Str");
  expression.toString(writer,localData);
  writer.append("String_Node_Str");
  p=0;
  for (int i=0; i < finalCommands.size(); i++) {
    if (finalCommands.get(i).isEmpty()) {
      continue;
    }
    if (p > 0) {
      writer.append("String_Node_Str");
    }
    finalCommands.get(i).toString(writer,localData);
    writer.stripSemicolon();
    p++;
  }
  writer.append("String_Node_Str").startBlock();
  for (  GraphTargetItem ti : commands) {
    if (!ti.isEmpty()) {
      ti.toStringSemicoloned(writer,localData).newLine();
    }
  }
  writer.endBlock();
  if (writer instanceof NulWriter) {
    LoopWithType loopOjb=((NulWriter)writer).endLoop(loop.id);
    labelUsed=loopOjb.used;
  }
  return writer;
}
Program: 61764
Project: 61764
Buggy source:
@Override public GraphTextWriter appendTo(GraphTextWriter writer,LocalData localData) throws InterruptedException {
  if (writer instanceof NulWriter) {
    ((NulWriter)writer).startLoop(loop.id,LoopWithType.LOOP_TYPE_LOOP);
  }
  if (labelUsed) {
    writer.append("String_Node_Str" + loop.id + "String_Node_Str").newLine();
  }
  writer.append("String_Node_Str").startBlock();
  for (  GraphTargetItem ti : commands) {
    if (!ti.isEmpty()) {
      ti.toStringSemicoloned(writer,localData).newLine();
    }
  }
  writer.endBlock();
  if (writer instanceof NulWriter) {
    LoopWithType loopOjb=((NulWriter)writer).endLoop(loop.id);
    labelUsed=loopOjb.used;
  }
  return writer;
}

Fixed version (ground truth):
@Override public GraphTextWriter appendTo(GraphTextWriter writer,LocalData localData) throws InterruptedException {
  if (writer instanceof NulWriter) {
    ((NulWriter)writer).startLoop(loop.id,LoopWithType.LOOP_TYPE_LOOP);
  }
  if (labelUsed) {
    writer.append("String_Node_Str" + loop.id + "String_Node_Str").newLine();
  }
  writer.append("String_Node_Str").startBlock();
  if (writer.getFormatting().spaceBeforeParenthesesWhileParentheses) {
    writer.append("String_Node_Str");
  }
  writer.append("String_Node_Str").startBlock();
  for (  GraphTargetItem ti : commands) {
    if (!ti.isEmpty()) {
      ti.toStringSemicoloned(writer,localData).newLine();
    }
  }
  writer.endBlock();
  if (writer instanceof NulWriter) {
    LoopWithType loopOjb=((NulWriter)writer).endLoop(loop.id);
    labelUsed=loopOjb.used;
  }
  return writer;
}