Program: 61563
Project: 61563
Buggy source:
public static int resolveType(SourceGeneratorLocalData localData,GraphTargetItem item,ABC abc,List<ABC> allABCs) throws CompilationException {
  int name_index=0;
  GraphTargetItem typeItem=null;
  if (item instanceof UnresolvedAVM2Item) {
    String fullClass=localData.getFullClass();
    item=((UnresolvedAVM2Item)item).resolve(new TypeItem(fullClass),new ArrayList<GraphTargetItem>(),new ArrayList<String>(),abc,allABCs,new ArrayList<MethodBody>(),new ArrayList<AssignableAVM2Item>());
  }
  if (item instanceof TypeItem) {
    typeItem=item;
  }
 else   if (item instanceof ApplyTypeAVM2Item) {
    typeItem=((ApplyTypeAVM2Item)item).object;
  }
 else {
    throw new CompilationException("String_Node_Str" + item.getClass().getName(),0);
  }
  if (typeItem instanceof UnresolvedAVM2Item) {
    String fullClass=localData.getFullClass();
    typeItem=((UnresolvedAVM2Item)typeItem).resolve(new TypeItem(fullClass),new ArrayList<GraphTargetItem>(),new ArrayList<String>(),abc,allABCs,new ArrayList<MethodBody>(),new ArrayList<AssignableAVM2Item>());
  }
  if (!(typeItem instanceof TypeItem)) {
    throw new CompilationException("String_Node_Str",0);
  }
  TypeItem type=(TypeItem)typeItem;
  String name=type.fullTypeName;
  String pkg="String_Node_Str";
  if (name.contains("String_Node_Str")) {
    pkg=name.substring(0,name.lastIndexOf('.'));
    name=name.substring(name.lastIndexOf('.') + 1);
  }
  for (  InstanceInfo ii : abc.instance_info) {
    Multiname mname=abc.constants.constant_multiname.get(ii.name_index);
    if (mname != null && name.equals(mname.getName(abc.constants,new ArrayList<String>(),true))) {
      if (mname.getNamespace(abc.constants).hasName(pkg,abc.constants)) {
        name_index=ii.name_index;
        break;
      }
    }
  }
  for (int i=1; i < abc.constants.constant_multiname.size(); i++) {
    Multiname mname=abc.constants.constant_multiname.get(i);
    if (mname != null && name.equals(mname.getName(abc.constants,new ArrayList<String>(),true))) {
      if (mname.getNamespace(abc.constants) != null && pkg.equals(mname.getNamespace(abc.constants).getName(abc.constants,true))) {
        name_index=i;
        break;
      }
    }
  }
  if (name_index == 0) {
    if (pkg.isEmpty() && localData.currentScript != null) {
      for (      Trait t : localData.currentScript.traits.traits) {
        if (t.getName(abc).getName(abc.constants,new ArrayList<String>(),true).equals(name)) {
          name_index=t.name_index;
          break;
        }
      }
    }
    if (name_index == 0) {
      name_index=abc.constants.getMultinameId(new Multiname(Multiname.QNAME,abc.constants.getStringId(name,true),abc.constants.getNamespaceId(new Namespace(Namespace.KIND_PACKAGE,abc.constants.getStringId(pkg,true)),0,true),0,0,new ArrayList<Integer>()),true);
    }
  }
  if (item instanceof ApplyTypeAVM2Item) {
    ApplyTypeAVM2Item atype=(ApplyTypeAVM2Item)item;
    List<Integer> params=new ArrayList<>();
    for (    GraphTargetItem s : atype.params) {
      params.add(resolveType(localData,s,abc,allABCs));
    }
    return abc.constants.getMultinameId(new Multiname(Multiname.TYPENAME,0,0,0,name_index,params),true);
  }
  return name_index;
}

Fixed version (ground truth):
public static int resolveType(SourceGeneratorLocalData localData,GraphTargetItem item,ABC abc,List<ABC> allABCs) throws CompilationException {
  int name_index=0;
  GraphTargetItem typeItem=null;
  if (item instanceof UnresolvedAVM2Item) {
    String fullClass=localData.getFullClass();
    item=((UnresolvedAVM2Item)item).resolve(new TypeItem(fullClass),new ArrayList<GraphTargetItem>(),new ArrayList<String>(),abc,allABCs,new ArrayList<MethodBody>(),new ArrayList<AssignableAVM2Item>());
  }
  if (item instanceof TypeItem) {
    typeItem=item;
  }
 else   if (item instanceof ApplyTypeAVM2Item) {
    typeItem=((ApplyTypeAVM2Item)item).object;
  }
 else {
    throw new CompilationException("String_Node_Str" + item + "String_Node_Str"+ item.getClass().getName()+ "String_Node_Str",0);
  }
  if (typeItem instanceof UnresolvedAVM2Item) {
    String fullClass=localData.getFullClass();
    typeItem=((UnresolvedAVM2Item)typeItem).resolve(new TypeItem(fullClass),new ArrayList<GraphTargetItem>(),new ArrayList<String>(),abc,allABCs,new ArrayList<MethodBody>(),new ArrayList<AssignableAVM2Item>());
  }
  if (!(typeItem instanceof TypeItem)) {
    throw new CompilationException("String_Node_Str",0);
  }
  TypeItem type=(TypeItem)typeItem;
  String name=type.fullTypeName;
  String pkg="String_Node_Str";
  if (name.contains("String_Node_Str")) {
    pkg=name.substring(0,name.lastIndexOf('.'));
    name=name.substring(name.lastIndexOf('.') + 1);
  }
  for (  InstanceInfo ii : abc.instance_info) {
    Multiname mname=abc.constants.constant_multiname.get(ii.name_index);
    if (mname != null && name.equals(mname.getName(abc.constants,new ArrayList<String>(),true))) {
      if (mname.getNamespace(abc.constants).hasName(pkg,abc.constants)) {
        name_index=ii.name_index;
        break;
      }
    }
  }
  for (int i=1; i < abc.constants.constant_multiname.size(); i++) {
    Multiname mname=abc.constants.constant_multiname.get(i);
    if (mname != null && name.equals(mname.getName(abc.constants,new ArrayList<String>(),true))) {
      if (mname.getNamespace(abc.constants) != null && pkg.equals(mname.getNamespace(abc.constants).getName(abc.constants,true))) {
        name_index=i;
        break;
      }
    }
  }
  if (name_index == 0) {
    if (pkg.isEmpty() && localData.currentScript != null) {
      for (      Trait t : localData.currentScript.traits.traits) {
        if (t.getName(abc).getName(abc.constants,new ArrayList<String>(),true).equals(name)) {
          name_index=t.name_index;
          break;
        }
      }
    }
    if (name_index == 0) {
      name_index=abc.constants.getMultinameId(new Multiname(Multiname.QNAME,abc.constants.getStringId(name,true),abc.constants.getNamespaceId(new Namespace(Namespace.KIND_PACKAGE,abc.constants.getStringId(pkg,true)),0,true),0,0,new ArrayList<Integer>()),true);
    }
  }
  if (item instanceof ApplyTypeAVM2Item) {
    ApplyTypeAVM2Item atype=(ApplyTypeAVM2Item)item;
    List<Integer> params=new ArrayList<>();
    for (    GraphTargetItem s : atype.params) {
      params.add(resolveType(localData,s,abc,allABCs));
    }
    return abc.constants.getMultinameId(new Multiname(Multiname.TYPENAME,0,0,0,name_index,params),true);
  }
  return name_index;
}