Program: 62206
Project: 62206
Buggy source:
public String toSource(String path,boolean isStatic,int classIndex,ABC abc,ConstantPool constants,MethodInfo method_info[],MethodBody body,boolean hilighted,HashMap<Integer,String> localRegNames,Stack<GraphTargetItem> scopeStack,boolean isStaticInitializer,List<String> fullyQualifiedNames,Traits initTraits){
  initToSource();
  List<GraphTargetItem> list;
  String s;
  HashMap<Integer,GraphTargetItem> localRegs=new HashMap<Integer,GraphTargetItem>();
  int regCount=getRegisterCount();
  int paramCount;
  if (body.method_info != -1) {
    MethodInfo mi=method_info[body.method_info];
    paramCount=mi.param_types.length;
    if (mi.flagNeed_rest()) {
      paramCount++;
    }
  }
  try {
    list=AVM2Graph.translateViaGraph(path,this,abc,body,isStatic,classIndex,localRegs,scopeStack,localRegNames,fullyQualifiedNames);
  }
 catch (  Exception ex2) {
    Logger.getLogger(AVM2Code.class.getName()).log(Level.SEVERE,"String_Node_Str" + path,ex2);
    return "String_Node_Str" + ex2.getMessage() + "String_Node_Str";
  }
  if (initTraits != null) {
    for (int i=0; i < list.size(); i++) {
      GraphTargetItem ti=list.get(i);
      if ((ti instanceof InitPropertyTreeItem) || (ti instanceof SetPropertyTreeItem)) {
        int multinameIndex=0;
        GraphTargetItem value=null;
        if (ti instanceof InitPropertyTreeItem) {
          multinameIndex=((InitPropertyTreeItem)ti).propertyName.multinameIndex;
          value=((InitPropertyTreeItem)ti).value;
        }
        if (ti instanceof SetPropertyTreeItem) {
          multinameIndex=((SetPropertyTreeItem)ti).propertyName.multinameIndex;
          value=((SetPropertyTreeItem)ti).value;
        }
        for (        Trait t : initTraits.traits) {
          if (t.name_index == multinameIndex) {
            if ((t instanceof TraitSlotConst)) {
              if (((TraitSlotConst)t).isConst() || isStaticInitializer) {
                ((TraitSlotConst)t).assignedValue=value;
                list.remove(i);
                i--;
                continue;
              }
              break;
            }
          }
        }
      }
 else {
      }
    }
  }
  if (isStaticInitializer) {
    List<GraphTargetItem> newList=new ArrayList<GraphTargetItem>();
    for (    GraphTargetItem ti : list) {
      if (!(ti instanceof ReturnVoidTreeItem)) {
        if (!(ti instanceof InitPropertyTreeItem)) {
          if (!(ti instanceof SetPropertyTreeItem)) {
            newList.add(ti);
          }
        }
      }
    }
    list=newList;
    if (list.isEmpty()) {
      return "String_Node_Str";
    }
  }
  boolean declaredRegisters[]=new boolean[regCount];
  for (int b=0; b < declaredRegisters.length; b++) {
    declaredRegisters[b]=false;
  }
  List<Slot> declaredSlots=new ArrayList<Slot>();
  for (int i=0; i < list.size(); i++) {
    GraphTargetItem ti=list.get(i);
    if (ti instanceof SetLocalTreeItem) {
      int reg=((SetLocalTreeItem)ti).regIndex;
      if (!declaredRegisters[reg]) {
        list.set(i,new DeclarationTreeItem(ti));
        declaredRegisters[reg]=true;
      }
    }
    if (ti instanceof SetSlotTreeItem) {
      SetSlotTreeItem ssti=(SetSlotTreeItem)ti;
      Slot sl=new Slot(ssti.scope,ssti.slotName);
      if (!declaredSlots.contains(sl)) {
        String type="String_Node_Str";
        for (int t=0; t < body.traits.traits.length; t++) {
          if (body.traits.traits[t].getName(abc) == sl.multiname) {
            if (body.traits.traits[t] instanceof TraitSlotConst) {
              type=((TraitSlotConst)body.traits.traits[t]).getType(constants,fullyQualifiedNames);
            }
          }
        }
        list.set(i,new DeclarationTreeItem(ti,type));
        declaredSlots.add(sl);
      }
    }
  }
  s=Graph.graphToString(list,constants,localRegNames,fullyQualifiedNames);
  if (!hilighted) {
    return Highlighting.stripHilights(s);
  }
  return s;
}

Fixed version (ground truth):
public String toSource(String path,boolean isStatic,int scriptIndex,int classIndex,ABC abc,ConstantPool constants,MethodInfo method_info[],MethodBody body,boolean hilighted,HashMap<Integer,String> localRegNames,Stack<GraphTargetItem> scopeStack,boolean isStaticInitializer,List<String> fullyQualifiedNames,Traits initTraits){
  initToSource();
  List<GraphTargetItem> list;
  String s;
  HashMap<Integer,GraphTargetItem> localRegs=new HashMap<Integer,GraphTargetItem>();
  int regCount=getRegisterCount();
  int paramCount;
  if (body.method_info != -1) {
    MethodInfo mi=method_info[body.method_info];
    paramCount=mi.param_types.length;
    if (mi.flagNeed_rest()) {
      paramCount++;
    }
  }
  try {
    list=AVM2Graph.translateViaGraph(path,this,abc,body,isStatic,scriptIndex,classIndex,localRegs,scopeStack,localRegNames,fullyQualifiedNames);
  }
 catch (  Exception ex2) {
    Logger.getLogger(AVM2Code.class.getName()).log(Level.SEVERE,"String_Node_Str" + path,ex2);
    return "String_Node_Str" + ex2.getMessage() + "String_Node_Str";
  }
  if (initTraits != null) {
    for (int i=0; i < list.size(); i++) {
      GraphTargetItem ti=list.get(i);
      if ((ti instanceof InitPropertyTreeItem) || (ti instanceof SetPropertyTreeItem)) {
        int multinameIndex=0;
        GraphTargetItem value=null;
        if (ti instanceof InitPropertyTreeItem) {
          multinameIndex=((InitPropertyTreeItem)ti).propertyName.multinameIndex;
          value=((InitPropertyTreeItem)ti).value;
        }
        if (ti instanceof SetPropertyTreeItem) {
          multinameIndex=((SetPropertyTreeItem)ti).propertyName.multinameIndex;
          value=((SetPropertyTreeItem)ti).value;
        }
        for (        Trait t : initTraits.traits) {
          if (t.name_index == multinameIndex) {
            if ((t instanceof TraitSlotConst)) {
              if (((TraitSlotConst)t).isConst() || isStaticInitializer) {
                ((TraitSlotConst)t).assignedValue=value;
                list.remove(i);
                i--;
                continue;
              }
              break;
            }
          }
        }
      }
 else {
      }
    }
  }
  if (isStaticInitializer) {
    List<GraphTargetItem> newList=new ArrayList<GraphTargetItem>();
    for (    GraphTargetItem ti : list) {
      if (!(ti instanceof ReturnVoidTreeItem)) {
        if (!(ti instanceof InitPropertyTreeItem)) {
          if (!(ti instanceof SetPropertyTreeItem)) {
            newList.add(ti);
          }
        }
      }
    }
    list=newList;
    if (list.isEmpty()) {
      return "String_Node_Str";
    }
  }
  boolean declaredRegisters[]=new boolean[regCount];
  for (int b=0; b < declaredRegisters.length; b++) {
    declaredRegisters[b]=false;
  }
  List<Slot> declaredSlots=new ArrayList<Slot>();
  for (int i=0; i < list.size(); i++) {
    GraphTargetItem ti=list.get(i);
    if (ti instanceof SetLocalTreeItem) {
      int reg=((SetLocalTreeItem)ti).regIndex;
      if (!declaredRegisters[reg]) {
        list.set(i,new DeclarationTreeItem(ti));
        declaredRegisters[reg]=true;
      }
    }
    if (ti instanceof SetSlotTreeItem) {
      SetSlotTreeItem ssti=(SetSlotTreeItem)ti;
      Slot sl=new Slot(ssti.scope,ssti.slotName);
      if (!declaredSlots.contains(sl)) {
        String type="String_Node_Str";
        for (int t=0; t < body.traits.traits.length; t++) {
          if (body.traits.traits[t].getName(abc) == sl.multiname) {
            if (body.traits.traits[t] instanceof TraitSlotConst) {
              type=((TraitSlotConst)body.traits.traits[t]).getType(constants,fullyQualifiedNames);
            }
          }
        }
        list.set(i,new DeclarationTreeItem(ti,type));
        declaredSlots.add(sl);
      }
    }
  }
  s=Graph.graphToString(list,constants,localRegNames,fullyQualifiedNames);
  if (!hilighted) {
    return Highlighting.stripHilights(s);
  }
  return s;
}