Program: 88584
Project: 88584
Buggy source:
private ArrayList addFinalLocals(polyglot.ast.ClassBody cBody,ArrayList finalLocals,polyglot.types.ClassType nodeKeyType,AnonLocalClassInfo info){
  ArrayList finalFields=new ArrayList();
  LocalUsesChecker luc=new LocalUsesChecker();
  cBody.visit(luc);
  Iterator localsNeededIt=luc.getLocals().iterator();
  ArrayList localsUsed=new ArrayList();
  while (localsNeededIt.hasNext()) {
    polyglot.types.LocalInstance li=(polyglot.types.LocalInstance)((polyglot.util.IdentityKey)localsNeededIt.next()).object();
    if (finalLocals.contains(new polyglot.util.IdentityKey(li))) {
      addFinals(li,finalFields);
      localsUsed.add(new polyglot.util.IdentityKey(li));
    }
  }
  Iterator newsIt=luc.getNews().iterator();
  while (newsIt.hasNext()) {
    polyglot.ast.New tempNew=(polyglot.ast.New)newsIt.next();
    polyglot.types.ClassType tempNewType=(polyglot.types.ClassType)tempNew.objectType().type();
    if (InitialResolver.v().finalLocalInfo().containsKey(new polyglot.util.IdentityKey(tempNewType))) {
      AnonLocalClassInfo lInfo=(AnonLocalClassInfo)InitialResolver.v().finalLocalInfo().get(new polyglot.util.IdentityKey(tempNewType));
      Iterator it=lInfo.finalLocals().iterator();
      while (it.hasNext()) {
        polyglot.types.LocalInstance li2=(polyglot.types.LocalInstance)((polyglot.util.IdentityKey)it.next()).object();
        if (!sootClass.declaresField("String_Node_Str" + li2.name(),Util.getSootType(li2.type()))) {
          addFinals(li2,finalFields);
          localsUsed.add(new polyglot.util.IdentityKey(li2));
        }
      }
    }
  }
  info.finalLocals(localsUsed);
  InitialResolver.v().finalLocalInfo().put(new polyglot.util.IdentityKey(nodeKeyType),info);
  return finalFields;
}

Fixed version (ground truth):
private ArrayList addFinalLocals(polyglot.ast.ClassBody cBody,ArrayList finalLocals,polyglot.types.ClassType nodeKeyType,AnonLocalClassInfo info){
  ArrayList finalFields=new ArrayList();
  LocalUsesChecker luc=new LocalUsesChecker();
  cBody.visit(luc);
  Iterator localsNeededIt=luc.getLocals().iterator();
  ArrayList localsUsed=new ArrayList();
  while (localsNeededIt.hasNext()) {
    polyglot.types.LocalInstance li=(polyglot.types.LocalInstance)((polyglot.util.IdentityKey)localsNeededIt.next()).object();
    if (finalLocals.contains(new polyglot.util.IdentityKey(li)) && !luc.getLocalDecls().contains(new polyglot.util.IdentityKey(li))) {
      addFinals(li,finalFields);
      localsUsed.add(new polyglot.util.IdentityKey(li));
    }
  }
  Iterator newsIt=luc.getNews().iterator();
  while (newsIt.hasNext()) {
    polyglot.ast.New tempNew=(polyglot.ast.New)newsIt.next();
    polyglot.types.ClassType tempNewType=(polyglot.types.ClassType)tempNew.objectType().type();
    if (InitialResolver.v().finalLocalInfo().containsKey(new polyglot.util.IdentityKey(tempNewType))) {
      AnonLocalClassInfo lInfo=(AnonLocalClassInfo)InitialResolver.v().finalLocalInfo().get(new polyglot.util.IdentityKey(tempNewType));
      Iterator it=lInfo.finalLocals().iterator();
      while (it.hasNext()) {
        polyglot.types.LocalInstance li2=(polyglot.types.LocalInstance)((polyglot.util.IdentityKey)it.next()).object();
        if (!sootClass.declaresField("String_Node_Str" + li2.name(),Util.getSootType(li2.type()))) {
          if (!luc.getLocalDecls().contains(new polyglot.util.IdentityKey(li2))) {
            addFinals(li2,finalFields);
            localsUsed.add(new polyglot.util.IdentityKey(li2));
          }
        }
      }
    }
  }
  info.finalLocals(localsUsed);
  InitialResolver.v().finalLocalInfo().put(new polyglot.util.IdentityKey(nodeKeyType),info);
  return finalFields;
}