Program: 61492
Project: 61492
Buggy source:
public void generateTraitsPhase2(List<DottedChain> importedClasses,DottedChain pkg,List<GraphTargetItem> items,Trait[] traits,List<Integer> openedNamespaces,SourceGeneratorLocalData localData) throws CompilationException {
  for (int k=0; k < items.size(); k++) {
    GraphTargetItem item=items.get(k);
    if (traits[k] == null) {
      continue;
    }
 else     if (item instanceof InterfaceAVM2Item) {
      traits[k].name_index=traitName(((InterfaceAVM2Item)item).namespace,((InterfaceAVM2Item)item).name);
    }
 else     if (item instanceof ClassAVM2Item) {
      traits[k].name_index=traitName(((ClassAVM2Item)item).namespace,((ClassAVM2Item)item).className);
    }
 else     if ((item instanceof MethodAVM2Item) || (item instanceof GetterAVM2Item) || (item instanceof SetterAVM2Item)) {
      traits[k].name_index=traitName(genNs(importedClasses,pkg,((MethodAVM2Item)item).customNamespace,((MethodAVM2Item)item).namespace,openedNamespaces,localData,((MethodAVM2Item)item).line),((MethodAVM2Item)item).functionName);
    }
 else     if (item instanceof FunctionAVM2Item) {
      traits[k].name_index=traitName(((FunctionAVM2Item)item).namespace,((FunctionAVM2Item)item).functionName);
    }
 else     if (item instanceof ConstAVM2Item) {
      traits[k].name_index=traitName(genNs(importedClasses,pkg,((ConstAVM2Item)item).customNamespace,((ConstAVM2Item)item).getNamespace(),openedNamespaces,localData,((ConstAVM2Item)item).line),((ConstAVM2Item)item).var);
    }
 else     if (item instanceof SlotAVM2Item) {
      traits[k].name_index=traitName(genNs(importedClasses,pkg,((SlotAVM2Item)item).customNamespace,((SlotAVM2Item)item).getNamespace(),openedNamespaces,localData,((SlotAVM2Item)item).line),((SlotAVM2Item)item).var);
    }
  }
  for (int k=0; k < items.size(); k++) {
    GraphTargetItem item=items.get(k);
    if (traits[k] == null) {
      continue;
    }
    if (item instanceof ClassAVM2Item) {
      InstanceInfo instanceInfo=abcIndex.getSelectedAbc().instance_info.get(((TraitClass)traits[k]).class_info);
      instanceInfo.name_index=abcIndex.getSelectedAbc().constants.getMultinameId(new Multiname(Multiname.QNAME,abcIndex.getSelectedAbc().constants.getStringId(((ClassAVM2Item)item).className,true),((ClassAVM2Item)item).namespace,0),true);
      if (((ClassAVM2Item)item).extendsOp != null) {
        instanceInfo.super_index=typeName(localData,((ClassAVM2Item)item).extendsOp);
      }
 else {
        instanceInfo.super_index=abcIndex.getSelectedAbc().constants.getMultinameId(new Multiname(Multiname.QNAME,str("String_Node_Str"),namespace(Namespace.KIND_PACKAGE,"String_Node_Str"),0),true);
      }
      instanceInfo.interfaces=new int[((ClassAVM2Item)item).implementsOp.size()];
      for (int i=0; i < ((ClassAVM2Item)item).implementsOp.size(); i++) {
        instanceInfo.interfaces[i]=superIntName(localData,((ClassAVM2Item)item).implementsOp.get(i));
      }
    }
    if (item instanceof InterfaceAVM2Item) {
      InstanceInfo instanceInfo=abcIndex.getSelectedAbc().instance_info.get(((TraitClass)traits[k]).class_info);
      instanceInfo.name_index=abcIndex.getSelectedAbc().constants.getMultinameId(new Multiname(Multiname.QNAME,abcIndex.getSelectedAbc().constants.getStringId(((InterfaceAVM2Item)item).name,true),abcIndex.getSelectedAbc().constants.getNamespaceId(Namespace.KIND_PACKAGE,((InterfaceAVM2Item)item).pkg,0,true),0),true);
      instanceInfo.interfaces=new int[((InterfaceAVM2Item)item).superInterfaces.size()];
      for (int i=0; i < ((InterfaceAVM2Item)item).superInterfaces.size(); i++) {
        GraphTargetItem un=((InterfaceAVM2Item)item).superInterfaces.get(i);
        instanceInfo.interfaces[i]=superIntName(localData,un);
      }
    }
  }
}

Fixed version (ground truth):
public void generateTraitsPhase2(List<DottedChain> importedClasses,DottedChain pkg,List<GraphTargetItem> items,Trait[] traits,List<Integer> openedNamespaces,SourceGeneratorLocalData localData) throws CompilationException {
  for (int k=0; k < items.size(); k++) {
    GraphTargetItem item=items.get(k);
    if (traits[k] == null) {
    }
 else     if (item instanceof InterfaceAVM2Item) {
      traits[k].name_index=traitName(((InterfaceAVM2Item)item).namespace,((InterfaceAVM2Item)item).name);
    }
 else     if (item instanceof ClassAVM2Item) {
      traits[k].name_index=traitName(((ClassAVM2Item)item).namespace,((ClassAVM2Item)item).className);
    }
 else     if ((item instanceof MethodAVM2Item) || (item instanceof GetterAVM2Item) || (item instanceof SetterAVM2Item)) {
      traits[k].name_index=traitName(genNs(importedClasses,pkg,((MethodAVM2Item)item).customNamespace,((MethodAVM2Item)item).namespace,openedNamespaces,localData,((MethodAVM2Item)item).line),((MethodAVM2Item)item).functionName);
    }
 else     if (item instanceof FunctionAVM2Item) {
      traits[k].name_index=traitName(((FunctionAVM2Item)item).namespace,((FunctionAVM2Item)item).functionName);
    }
 else     if (item instanceof ConstAVM2Item) {
      traits[k].name_index=traitName(genNs(importedClasses,pkg,((ConstAVM2Item)item).customNamespace,((ConstAVM2Item)item).getNamespace(),openedNamespaces,localData,((ConstAVM2Item)item).line),((ConstAVM2Item)item).var);
    }
 else     if (item instanceof SlotAVM2Item) {
      traits[k].name_index=traitName(genNs(importedClasses,pkg,((SlotAVM2Item)item).customNamespace,((SlotAVM2Item)item).getNamespace(),openedNamespaces,localData,((SlotAVM2Item)item).line),((SlotAVM2Item)item).var);
    }
  }
  for (int k=0; k < items.size(); k++) {
    GraphTargetItem item=items.get(k);
    if (traits[k] == null) {
      continue;
    }
    if (item instanceof ClassAVM2Item) {
      InstanceInfo instanceInfo=abcIndex.getSelectedAbc().instance_info.get(((TraitClass)traits[k]).class_info);
      instanceInfo.name_index=abcIndex.getSelectedAbc().constants.getMultinameId(new Multiname(Multiname.QNAME,abcIndex.getSelectedAbc().constants.getStringId(((ClassAVM2Item)item).className,true),((ClassAVM2Item)item).namespace,0),true);
      if (((ClassAVM2Item)item).extendsOp != null) {
        instanceInfo.super_index=typeName(localData,((ClassAVM2Item)item).extendsOp);
      }
 else {
        instanceInfo.super_index=abcIndex.getSelectedAbc().constants.getMultinameId(new Multiname(Multiname.QNAME,str("String_Node_Str"),namespace(Namespace.KIND_PACKAGE,"String_Node_Str"),0),true);
      }
      instanceInfo.interfaces=new int[((ClassAVM2Item)item).implementsOp.size()];
      for (int i=0; i < ((ClassAVM2Item)item).implementsOp.size(); i++) {
        instanceInfo.interfaces[i]=superIntName(localData,((ClassAVM2Item)item).implementsOp.get(i));
      }
    }
    if (item instanceof InterfaceAVM2Item) {
      InstanceInfo instanceInfo=abcIndex.getSelectedAbc().instance_info.get(((TraitClass)traits[k]).class_info);
      instanceInfo.name_index=abcIndex.getSelectedAbc().constants.getMultinameId(new Multiname(Multiname.QNAME,abcIndex.getSelectedAbc().constants.getStringId(((InterfaceAVM2Item)item).name,true),abcIndex.getSelectedAbc().constants.getNamespaceId(Namespace.KIND_PACKAGE,((InterfaceAVM2Item)item).pkg,0,true),0),true);
      instanceInfo.interfaces=new int[((InterfaceAVM2Item)item).superInterfaces.size()];
      for (int i=0; i < ((InterfaceAVM2Item)item).superInterfaces.size(); i++) {
        GraphTargetItem un=((InterfaceAVM2Item)item).superInterfaces.get(i);
        instanceInfo.interfaces[i]=superIntName(localData,un);
      }
    }
  }
}