nus-yam/ex-repair huggingface dataset:
Program: 88625
Project: 88625
Buggy source:
public boolean update(){
  final jedd.internal.RelationContainer newEdges=new jedd.internal.RelationContainer(new jedd.Attribute[]{srcc.v(),srcm.v(),stmt.v(),kind.v(),tgtc.v(),tgtm.v()},new jedd.PhysicalDomain[]{V1.v(),T1.v(),ST.v(),FD.v(),V2.v(),T2.v()},("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"),in.get());
  newEdges.eqMinus(edges);
  edges.eqUnion(newEdges);
  out.add(new jedd.internal.RelationContainer(new jedd.Attribute[]{tgtm.v(),kind.v(),srcc.v(),srcm.v(),tgtc.v(),stmt.v()},new jedd.PhysicalDomain[]{T2.v(),FD.v(),V1.v(),T1.v(),V2.v(),ST.v()},("String_Node_Str" + "String_Node_Str"),newEdges));
  return !jedd.internal.Jedd.v().equals(jedd.internal.Jedd.v().read(newEdges),jedd.internal.Jedd.v().falseBDD());
}

Fixed version (ground truth):
public boolean update(){
  final jedd.internal.RelationContainer newEdges=new jedd.internal.RelationContainer(new jedd.Attribute[]{srcc.v(),srcm.v(),stmt.v(),kind.v(),tgtc.v(),tgtm.v()},new jedd.PhysicalDomain[]{V1.v(),T1.v(),ST.v(),FD.v(),V2.v(),T2.v()},("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"),in.get());
  newEdges.eqMinus(edges);
  edges.eqUnion(newEdges);
  out.add(new jedd.internal.RelationContainer(new jedd.Attribute[]{stmt.v(),srcm.v(),tgtc.v(),tgtm.v(),srcc.v(),kind.v()},new jedd.PhysicalDomain[]{ST.v(),T1.v(),V2.v(),T2.v(),V1.v(),FD.v()},("String_Node_Str" + "String_Node_Str"),newEdges));
  return !jedd.internal.Jedd.v().equals(jedd.internal.Jedd.v().read(newEdges),jedd.internal.Jedd.v().falseBDD());
}
Program: 88626
Project: 88626
Buggy source:
public Rsrcc_srcm_stmt_kind_tgtc_tgtm edgesOutOf(MethodOrMethodContext m){
  return new Rsrcc_srcm_stmt_kind_tgtc_tgtmBDD(new jedd.internal.RelationContainer(new jedd.Attribute[]{kind.v(),tgtm.v(),srcc.v(),srcm.v(),stmt.v(),tgtc.v()},new jedd.PhysicalDomain[]{FD.v(),T2.v(),V1.v(),T1.v(),ST.v(),V2.v()},("String_Node_Str" + "String_Node_Str" + "String_Node_Str"),jedd.internal.Jedd.v().join(jedd.internal.Jedd.v().read(edges),jedd.internal.Jedd.v().literal(new Object[]{m.context(),m.method()},new jedd.Attribute[]{ctxt.v(),method.v()},new jedd.PhysicalDomain[]{V1.v(),T1.v()}),new jedd.PhysicalDomain[]{T1.v(),V1.v()})),"String_Node_Str");
}

Fixed version (ground truth):
public Rsrcc_srcm_stmt_kind_tgtc_tgtm edgesOutOf(MethodOrMethodContext m){
  return new Rsrcc_srcm_stmt_kind_tgtc_tgtmBDD(new jedd.internal.RelationContainer(new jedd.Attribute[]{srcm.v(),stmt.v(),tgtc.v(),tgtm.v(),srcc.v(),kind.v()},new jedd.PhysicalDomain[]{T1.v(),ST.v(),V2.v(),T2.v(),V1.v(),FD.v()},("String_Node_Str" + "String_Node_Str" + "String_Node_Str"),jedd.internal.Jedd.v().join(jedd.internal.Jedd.v().read(edges),jedd.internal.Jedd.v().literal(new Object[]{m.context(),m.method()},new jedd.Attribute[]{ctxt.v(),method.v()},new jedd.PhysicalDomain[]{V1.v(),T1.v()}),new jedd.PhysicalDomain[]{T1.v(),V1.v()})),"String_Node_Str");
}
Program: 88628
Project: 88628
Buggy source:
/** 
 * Verifies the prospective name for validity as a Jimple name. In particular, first-char is alpha | _ | $, subsequent-chars  are alphanum | _ | $.  We could use isJavaIdentifier, except that Jimple's grammar doesn't support all of those, just ASCII. I'd put this in soot.Local, but that's an interface.
 * @author Patrick Lam
 */
boolean isValidJimpleName(String prospectiveName){
  for (int i=0; i < prospectiveName.length(); i++) {
    char c=prospectiveName.charAt(i);
    if (i == 0 && c >= '0' && c <= '9')     return false;
    if (!((c >= '0' && c <= '9') || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')|| (c == '_' || c == '$')))     return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Verifies the prospective name for validity as a Jimple name. In particular, first-char is alpha | _ | $, subsequent-chars  are alphanum | _ | $.  We could use isJavaIdentifier, except that Jimple's grammar doesn't support all of those, just ASCII. I'd put this in soot.Local, but that's an interface.
 * @author Patrick Lam
 */
boolean isValidJimpleName(String prospectiveName){
  if (prospectiveName == null)   return false;
  for (int i=0; i < prospectiveName.length(); i++) {
    char c=prospectiveName.charAt(i);
    if (i == 0 && c >= '0' && c <= '9')     return false;
    if (!((c >= '0' && c <= '9') || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')|| (c == '_' || c == '$')))     return false;
  }
  return true;
}
Program: 88631
Project: 88631
Buggy source:
/** 
 * adds outer class params
 */
private void handleOuterClassParams(ArrayList sootParams,ArrayList sootParamsTypes,polyglot.types.ClassType typeToInvoke){
  ArrayList needsRef=soot.javaToJimple.InitialResolver.v().getHasOuterRefInInit();
  if ((needsRef != null) && (needsRef.contains(Util.getSootType(typeToInvoke)))) {
    soot.SootClass outerClass=((soot.RefType)Util.getSootType(typeToInvoke.outer())).getSootClass();
    soot.Local classToInvokeOuterParam=getThis(outerClass.getType());
    sootParamsTypes.add(outerClass.getType());
    sootParams.add(classToInvokeOuterParam);
  }
}

Fixed version (ground truth):
/** 
 * adds outer class params
 */
private void handleOuterClassParams(ArrayList sootParams,soot.Value qVal,ArrayList sootParamsTypes,polyglot.types.ClassType typeToInvoke){
  ArrayList needsRef=soot.javaToJimple.InitialResolver.v().getHasOuterRefInInit();
  boolean addRef=(needsRef != null) && (needsRef.contains(Util.getSootType(typeToInvoke)));
  if (addRef) {
    soot.SootClass outerClass=((soot.RefType)Util.getSootType(typeToInvoke.outer())).getSootClass();
    sootParamsTypes.add(outerClass.getType());
  }
  if (addRef && !typeToInvoke.isAnonymous() && (qVal != null)) {
    sootParams.add(qVal);
  }
 else   if (addRef && !typeToInvoke.isAnonymous()) {
    soot.SootClass outerClass=((soot.RefType)Util.getSootType(typeToInvoke.outer())).getSootClass();
    sootParams.add(getThis(outerClass.getType()));
  }
 else   if (addRef && typeToInvoke.isAnonymous()) {
    soot.SootClass outerClass=((soot.RefType)Util.getSootType(typeToInvoke.outer())).getSootClass();
    sootParams.add(getThis(outerClass.getType()));
  }
  if (typeToInvoke.isAnonymous() && (qVal != null)) {
    sootParamsTypes.add(qVal.getType());
    sootParams.add(qVal);
  }
}
Program: 88633
Project: 88633
Buggy source:
/** 
 * Gets the Soot Method form the given Soot Class
 */
private soot.SootMethod getMethodFromClass(soot.SootClass sootClass,String name,ArrayList paramTypes,soot.Type returnType){
  try {
    return sootClass.getMethod(name,paramTypes,returnType);
  }
 catch (  Exception e) {
    if (paramTypes != null && !paramTypes.isEmpty()) {
      soot.SootClass firstParam=((soot.RefType)paramTypes.get(0)).getSootClass();
      boolean foundMeth=false;
      while (!foundMeth) {
        paramTypes.set(0,firstParam.getSuperclass().getType());
        if (sootClass.declaresMethod(name,paramTypes,returnType)) {
          return sootClass.getMethod(name,paramTypes,returnType);
        }
        firstParam=firstParam.getSuperclass();
      }
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Gets the Soot Method form the given Soot Class
 */
private soot.SootMethod getMethodFromClass(soot.SootClass sootClass,String name,ArrayList paramTypes,soot.Type returnType){
  return sootClass.getMethod(name,paramTypes,returnType);
}
Program: 88637
Project: 88637
Buggy source:
private String createStringConstant(polyglot.ast.Node node){
  String s=null;
  if (node instanceof polyglot.ast.StringLit) {
    s=((polyglot.ast.StringLit)node).value();
  }
 else   if (node instanceof polyglot.ast.Field) {
    s=(((polyglot.ast.Field)node).fieldInstance().constantValue()).toString();
  }
 else   if (node instanceof polyglot.ast.Binary) {
    s=createStringConstantBinary((polyglot.ast.Binary)node);
  }
 else {
    throw new RuntimeException("String_Node_Str");
  }
  return s;
}

Fixed version (ground truth):
private String createStringConstant(polyglot.ast.Node node){
  String s=null;
  if (node instanceof polyglot.ast.StringLit) {
    s=((polyglot.ast.StringLit)node).value();
  }
 else   if (node instanceof polyglot.ast.Cast) {
    polyglot.ast.Cast cast=(polyglot.ast.Cast)node;
    if (cast.type().isChar()) {
      s="String_Node_Str" + (char)((Character)cast.constantValue()).charValue();
    }
 else {
      s="String_Node_Str" + cast.constantValue();
    }
  }
 else   if (node instanceof polyglot.ast.CharLit) {
    s="String_Node_Str" + ((polyglot.ast.CharLit)node).value();
  }
 else   if (node instanceof polyglot.ast.BooleanLit) {
    s="String_Node_Str" + ((polyglot.ast.BooleanLit)node).value();
  }
 else   if (node instanceof polyglot.ast.IntLit) {
    s="String_Node_Str" + ((polyglot.ast.IntLit)node).value();
  }
 else   if (node instanceof polyglot.ast.FloatLit) {
    s="String_Node_Str" + ((polyglot.ast.FloatLit)node).value();
  }
 else   if (node instanceof polyglot.ast.Field) {
    polyglot.ast.Field field=(polyglot.ast.Field)node;
    if (field.fieldInstance().constantValue() instanceof String) {
      s=(String)field.constantValue();
    }
 else     if (field.fieldInstance().constantValue() instanceof Boolean) {
      boolean val=((Boolean)field.constantValue()).booleanValue();
      int temp=val ? 1 : 0;
      s="String_Node_Str" + temp;
    }
 else     if (field.type().isChar()) {
      char val=(char)((Integer)field.constantValue()).intValue();
      s="String_Node_Str" + val;
    }
 else {
      Number num=(Number)field.fieldInstance().constantValue();
      num=createConstantCast(field.type(),num);
      if (num instanceof Long) {
        s="String_Node_Str" + ((Long)num).longValue();
      }
 else       if (num instanceof Double) {
        s="String_Node_Str" + ((Double)num).doubleValue();
      }
 else       if (num instanceof Float) {
        s="String_Node_Str" + ((Float)num).floatValue();
      }
 else       if (num instanceof Byte) {
        s="String_Node_Str" + ((Byte)num).byteValue();
      }
 else       if (num instanceof Short) {
        s="String_Node_Str" + ((Short)num).shortValue();
      }
 else {
        s="String_Node_Str" + ((Integer)num).intValue();
      }
    }
  }
 else   if (node instanceof polyglot.ast.Binary) {
    s=createStringConstantBinary((polyglot.ast.Binary)node);
  }
 else {
    throw new RuntimeException("String_Node_Str");
  }
  return s;
}
Program: 88638
Project: 88638
Buggy source:
private boolean areAllStringLits(polyglot.ast.Node node){
  if (node instanceof polyglot.ast.StringLit)   return true;
 else   if (node instanceof polyglot.ast.Field) {
    if (shouldReturnConstant((polyglot.ast.Field)node))     return true;
 else     return false;
  }
 else   if (node instanceof polyglot.ast.Binary) {
    if (areAllStringLitsBinary((polyglot.ast.Binary)node))     return true;
    return false;
  }
  return false;
}

Fixed version (ground truth):
private boolean areAllStringLits(polyglot.ast.Node node){
  if (node instanceof polyglot.ast.StringLit)   return true;
 else   if (node instanceof polyglot.ast.Field) {
    if (shouldReturnConstant((polyglot.ast.Field)node))     return true;
 else     return false;
  }
 else   if (node instanceof polyglot.ast.Binary) {
    if (areAllStringLitsBinary((polyglot.ast.Binary)node))     return true;
    return false;
  }
 else   if (node instanceof polyglot.ast.Cast) {
    polyglot.ast.Cast cast=(polyglot.ast.Cast)node;
    if (cast.isConstant()) {
      return true;
    }
    return false;
  }
 else   if (node instanceof polyglot.ast.Lit) {
    polyglot.ast.Lit lit=(polyglot.ast.Lit)node;
    if (lit.isConstant()) {
      return true;
    }
    return false;
  }
  return false;
}
Program: 88639
Project: 88639
Buggy source:
private soot.jimple.Constant getReturnConstant(polyglot.ast.Field field){
  if (field.fieldInstance().constantValue() instanceof String) {
    return soot.jimple.StringConstant.v((String)field.constantValue());
  }
 else   if (field.fieldInstance().constantValue() instanceof Boolean) {
    boolean val=((Boolean)field.constantValue()).booleanValue();
    return soot.jimple.IntConstant.v(val ? 1 : 0);
  }
 else   if (field.fieldInstance().constantValue() instanceof Character) {
    char val=((Character)field.constantValue()).charValue();
    return soot.jimple.IntConstant.v(val);
  }
 else {
    Number num=(Number)field.fieldInstance().constantValue();
    num=createConstantCast(field.type(),num);
    if (num instanceof Long) {
      return soot.jimple.LongConstant.v(((Long)num).longValue());
    }
 else     if (num instanceof Double) {
      return soot.jimple.DoubleConstant.v(((Double)num).doubleValue());
    }
 else     if (num instanceof Float) {
      return soot.jimple.FloatConstant.v(((Float)num).floatValue());
    }
 else     if (num instanceof Byte) {
      return soot.jimple.IntConstant.v(((Byte)num).byteValue());
    }
 else     if (num instanceof Short) {
      return soot.jimple.IntConstant.v(((Short)num).shortValue());
    }
 else {
      return soot.jimple.IntConstant.v(((Integer)num).intValue());
    }
  }
}

Fixed version (ground truth):
private soot.jimple.Constant getReturnConstant(polyglot.ast.Field field){
  if (field.fieldInstance().constantValue() instanceof String) {
    return soot.jimple.StringConstant.v((String)field.constantValue());
  }
 else   if (field.fieldInstance().constantValue() instanceof Boolean) {
    boolean val=((Boolean)field.constantValue()).booleanValue();
    return soot.jimple.IntConstant.v(val ? 1 : 0);
  }
 else   if (field.type().isChar()) {
    char val=(char)((Integer)field.constantValue()).intValue();
    return soot.jimple.IntConstant.v(val);
  }
 else {
    Number num=(Number)field.fieldInstance().constantValue();
    num=createConstantCast(field.type(),num);
    if (num instanceof Long) {
      return soot.jimple.LongConstant.v(((Long)num).longValue());
    }
 else     if (num instanceof Double) {
      return soot.jimple.DoubleConstant.v(((Double)num).doubleValue());
    }
 else     if (num instanceof Float) {
      return soot.jimple.FloatConstant.v(((Float)num).floatValue());
    }
 else     if (num instanceof Byte) {
      return soot.jimple.IntConstant.v(((Byte)num).byteValue());
    }
 else     if (num instanceof Short) {
      return soot.jimple.IntConstant.v(((Short)num).shortValue());
    }
 else {
      return soot.jimple.IntConstant.v(((Integer)num).intValue());
    }
  }
}
Program: 88640
Project: 88640
Buggy source:
public void caseFloatConstant(FloatConstant v){
  if (v.value == 0)   emit("String_Node_Str",1);
 else   if (v.value == 1)   emit("String_Node_Str",1);
 else   if (v.value == 2)   emit("String_Node_Str",1);
 else {
    String s=v.toString();
    if (s.equals("String_Node_Str"))     s="String_Node_Str";
    if (s.equals("String_Node_Str"))     s="String_Node_Str";
    if (s.equals("String_Node_Str"))     s="String_Node_Str";
    emit("String_Node_Str" + s,1);
  }
}

Fixed version (ground truth):
public void caseFloatConstant(FloatConstant v){
  if ((v.value == 0) && ((1.0f / v.value) > 0.0f))   emit("String_Node_Str",1);
 else   if (v.value == 1)   emit("String_Node_Str",1);
 else   if (v.value == 2)   emit("String_Node_Str",1);
 else {
    String s=v.toString();
    if (s.equals("String_Node_Str"))     s="String_Node_Str";
    if (s.equals("String_Node_Str"))     s="String_Node_Str";
    if (s.equals("String_Node_Str"))     s="String_Node_Str";
    emit("String_Node_Str" + s,1);
  }
}
Program: 88641
Project: 88641
Buggy source:
public void caseDoubleConstant(DoubleConstant v){
  if (v.value == 0)   emit("String_Node_Str",2);
 else   if (v.value == 1)   emit("String_Node_Str",2);
 else {
    String s=v.toString();
    if (s.equals("String_Node_Str"))     s="String_Node_Str";
    if (s.equals("String_Node_Str"))     s="String_Node_Str";
    if (s.equals("String_Node_Str"))     s="String_Node_Str";
    emit("String_Node_Str" + s,2);
  }
}

Fixed version (ground truth):
public void caseDoubleConstant(DoubleConstant v){
  if ((v.value == 0) && ((1.0 / v.value) > 0.0))   emit("String_Node_Str",2);
 else   if (v.value == 1)   emit("String_Node_Str",2);
 else {
    String s=v.toString();
    if (s.equals("String_Node_Str"))     s="String_Node_Str";
    if (s.equals("String_Node_Str"))     s="String_Node_Str";
    if (s.equals("String_Node_Str"))     s="String_Node_Str";
    emit("String_Node_Str" + s,2);
  }
}
Program: 88643
Project: 88643
Buggy source:
/** 
 * Return Stmts Creation
 */
private void createReturn(polyglot.ast.Return retStmt){
  polyglot.ast.Expr expr=retStmt.expr();
  soot.Value sootLocal=null;
  if (expr != null) {
    sootLocal=createExpr(expr);
  }
  if (monitorStack != null) {
    Stack putBack=new Stack();
    while (!monitorStack.isEmpty()) {
      soot.Local exitVal=(soot.Local)monitorStack.pop();
      putBack.push(exitVal);
      soot.jimple.ExitMonitorStmt emStmt=soot.jimple.Jimple.v().newExitMonitorStmt(exitVal);
      body.getUnits().add(emStmt);
    }
    while (!putBack.isEmpty()) {
      monitorStack.push(putBack.pop());
    }
  }
  if (expr == null) {
    soot.jimple.Stmt retStmtVoid=soot.jimple.Jimple.v().newReturnVoidStmt();
    body.getUnits().add(retStmtVoid);
    Util.addLnPosTags(retStmtVoid,retStmt.position());
  }
 else {
    if (sootLocal instanceof soot.jimple.ConditionExpr) {
      sootLocal=handleCondBinExpr((soot.jimple.ConditionExpr)sootLocal);
    }
    soot.jimple.ReturnStmt retStmtLocal=soot.jimple.Jimple.v().newReturnStmt(sootLocal);
    body.getUnits().add(retStmtLocal);
    Util.addLnPosTags(retStmtLocal.getOpBox(),expr.position());
    Util.addLnPosTags(retStmtLocal,retStmt.position());
  }
}

Fixed version (ground truth):
/** 
 * Return Stmts Creation
 */
private void createReturn(polyglot.ast.Return retStmt){
  polyglot.ast.Expr expr=retStmt.expr();
  soot.Value sootLocal=null;
  if (expr != null) {
    sootLocal=createExpr(expr);
  }
  if (monitorStack != null) {
    Stack putBack=new Stack();
    while (!monitorStack.isEmpty()) {
      soot.Local exitVal=(soot.Local)monitorStack.pop();
      putBack.push(exitVal);
      soot.jimple.ExitMonitorStmt emStmt=soot.jimple.Jimple.v().newExitMonitorStmt(exitVal);
      body.getUnits().add(emStmt);
    }
    while (!putBack.isEmpty()) {
      monitorStack.push(putBack.pop());
    }
  }
  if (currentTryStmt != null) {
    createBlock(currentTryStmt.finallyBlock());
  }
  if (expr == null) {
    soot.jimple.Stmt retStmtVoid=soot.jimple.Jimple.v().newReturnVoidStmt();
    body.getUnits().add(retStmtVoid);
    Util.addLnPosTags(retStmtVoid,retStmt.position());
  }
 else {
    if (sootLocal instanceof soot.jimple.ConditionExpr) {
      sootLocal=handleCondBinExpr((soot.jimple.ConditionExpr)sootLocal);
    }
    soot.jimple.ReturnStmt retStmtLocal=soot.jimple.Jimple.v().newReturnStmt(sootLocal);
    body.getUnits().add(retStmtLocal);
    Util.addLnPosTags(retStmtLocal.getOpBox(),expr.position());
    Util.addLnPosTags(retStmtLocal,retStmt.position());
  }
}
Program: 88645
Project: 88645
Buggy source:
public void internalTransform(String phaseName,Map opts){
  Iterator it=Scene.v().getApplicationClasses().iterator();
  while (it.hasNext()) {
    SootClass sc=(SootClass)it.next();
    HashMap lineToMeth=new HashMap();
    Iterator methIt=sc.getMethods().iterator();
    while (methIt.hasNext()) {
      SootMethod meth=(SootMethod)methIt.next();
      Body body=meth.retrieveActiveBody();
      Stmt s=(Stmt)body.getUnits().getFirst();
      while (s instanceof IdentityStmt) {
        s=(Stmt)body.getUnits().getSuccOf(s);
      }
      if (s.hasTag("String_Node_Str")) {
        LineNumberTag tag=(LineNumberTag)s.getTag("String_Node_Str");
        lineToMeth.put(new Integer(tag.getLineNumber()),meth);
      }
    }
    Iterator methIt2=sc.getMethods().iterator();
    while (methIt2.hasNext()) {
      SootMethod meth=(SootMethod)methIt2.next();
      Body body=meth.retrieveActiveBody();
      Stmt s=(Stmt)body.getUnits().getFirst();
      while (s instanceof IdentityStmt) {
        s=(Stmt)body.getUnits().getSuccOf(s);
      }
      if (s.hasTag("String_Node_Str")) {
        LineNumberTag tag=(LineNumberTag)s.getTag("String_Node_Str");
        int line_num=tag.getLineNumber() - 1;
        if (lineToMeth.containsKey(new Integer(line_num))) {
          meth.addTag(new LineNumberTag(line_num + 1));
        }
 else {
          meth.addTag(new LineNumberTag(line_num));
        }
      }
    }
  }
}

Fixed version (ground truth):
public void internalTransform(String phaseName,Map opts){
  Iterator it=Scene.v().getApplicationClasses().iterator();
  while (it.hasNext()) {
    SootClass sc=(SootClass)it.next();
    HashMap lineToMeth=new HashMap();
    Iterator methIt=sc.getMethods().iterator();
    while (methIt.hasNext()) {
      SootMethod meth=(SootMethod)methIt.next();
      if (!meth.isConcrete())       continue;
      Body body=meth.retrieveActiveBody();
      Stmt s=(Stmt)body.getUnits().getFirst();
      while (s instanceof IdentityStmt) {
        s=(Stmt)body.getUnits().getSuccOf(s);
      }
      if (s.hasTag("String_Node_Str")) {
        LineNumberTag tag=(LineNumberTag)s.getTag("String_Node_Str");
        lineToMeth.put(new Integer(tag.getLineNumber()),meth);
      }
    }
    Iterator methIt2=sc.getMethods().iterator();
    while (methIt2.hasNext()) {
      SootMethod meth=(SootMethod)methIt2.next();
      if (!meth.isConcrete())       continue;
      Body body=meth.retrieveActiveBody();
      Stmt s=(Stmt)body.getUnits().getFirst();
      while (s instanceof IdentityStmt) {
        s=(Stmt)body.getUnits().getSuccOf(s);
      }
      if (s.hasTag("String_Node_Str")) {
        LineNumberTag tag=(LineNumberTag)s.getTag("String_Node_Str");
        int line_num=tag.getLineNumber() - 1;
        if (lineToMeth.containsKey(new Integer(line_num))) {
          meth.addTag(new LineNumberTag(line_num + 1));
        }
 else {
          meth.addTag(new LineNumberTag(line_num));
        }
      }
    }
  }
}
Program: 88646
Project: 88646
Buggy source:
/** 
 * Gets the Soot Method form the given Soot Class
 */
private soot.SootMethod getMethodFromClass(soot.SootClass sootClass,String name,ArrayList paramTypes,soot.Type returnType){
  return sootClass.getMethod(name,paramTypes,returnType);
}

Fixed version (ground truth):
/** 
 * Gets the Soot Method form the given Soot Class
 */
private soot.SootMethod getMethodFromClass(soot.SootClass sootClass,String name,ArrayList paramTypes,soot.Type returnType){
  try {
    return sootClass.getMethod(name,paramTypes,returnType);
  }
 catch (  Exception e) {
    if (paramTypes != null && !paramTypes.isEmpty()) {
      soot.SootClass firstParam=((soot.RefType)paramTypes.get(0)).getSootClass();
      boolean foundMeth=false;
      while (!foundMeth) {
        paramTypes.set(0,firstParam.getSuperclass().getType());
        if (sootClass.declaresMethod(name,paramTypes,returnType)) {
          return sootClass.getMethod(name,paramTypes,returnType);
        }
        firstParam=firstParam.getSuperclass();
      }
    }
  }
  return null;
}
Program: 88647
Project: 88647
Buggy source:
/** 
 * adds modifiers
 */
private void addModifiers(polyglot.types.Flags flags,polyglot.ast.ClassDecl cDecl){
  int modifiers=0;
  if (cDecl.type().isNested()) {
    if (flags.isPublic() || flags.isProtected() || flags.isPrivate()) {
      modifiers=soot.Modifier.PUBLIC;
    }
    if (flags.isInterface()) {
      modifiers=modifiers | soot.Modifier.INTERFACE;
    }
    if (cDecl.type().outer().flags().isInterface()) {
      modifiers=soot.Modifier.PUBLIC;
    }
  }
 else {
    modifiers=Util.getModifier(flags);
  }
  sootClass.setModifiers(modifiers);
}

Fixed version (ground truth):
/** 
 * adds modifiers
 */
private void addModifiers(polyglot.types.Flags flags,polyglot.ast.ClassDecl cDecl){
  int modifiers=0;
  if (cDecl.type().isNested()) {
    if (flags.isPublic() || flags.isProtected() || flags.isPrivate()) {
      modifiers=soot.Modifier.PUBLIC;
    }
    if (flags.isInterface()) {
      modifiers=modifiers | soot.Modifier.INTERFACE;
    }
    if (cDecl.type().outer().flags().isInterface()) {
      modifiers=modifiers | soot.Modifier.PUBLIC;
    }
  }
 else {
    modifiers=Util.getModifier(flags);
  }
  sootClass.setModifiers(modifiers);
}
Program: 88649
Project: 88649
Buggy source:
public String toString(){
  StringBuffer ret=new StringBuffer();
  if (fields == null)   return "String_Node_Str";
  for (Iterator fieldIt=fields.keySet().iterator(); fieldIt.hasNext(); ) {
    final Object field=(Object)fieldIt.next();
    ret.append("String_Node_Str" + field + "String_Node_Str"+ fields.get(field)+ "String_Node_Str");
  }
  return ret.toString();
}

Fixed version (ground truth):
public String toString(){
  boolean empty=true;
  StringBuffer ret=new StringBuffer();
  if (fields != null) {
    for (Iterator fieldIt=fields.keySet().iterator(); fieldIt.hasNext(); ) {
      final Object field=(Object)fieldIt.next();
      ret.append("String_Node_Str" + field + "String_Node_Str"+ fields.get(field)+ "String_Node_Str");
      empty=false;
    }
  }
  if (globals != null) {
    for (Iterator globalIt=globals.iterator(); globalIt.hasNext(); ) {
      final Object global=(Object)globalIt.next();
      ret.append("String_Node_Str" + global + "String_Node_Str");
      empty=false;
    }
  }
  if (empty)   ret.append("String_Node_Str");
  return ret.toString();
}
Program: 88650
Project: 88650
Buggy source:
public void findNTRWSets(SootMethod method){
  if (methodToNTReadSet.containsKey(method) && methodToNTWriteSet.containsKey(method))   return;
  MethodRWSet read=new MethodRWSet();
  MethodRWSet write=new MethodRWSet();
  for (Iterator sIt=method.retrieveActiveBody().getUnits().iterator(); sIt.hasNext(); ) {
    final Stmt s=(Stmt)sIt.next();
    read.union(ntReadSet(method,s));
    write.union(ntWriteSet(method,s));
  }
  methodToNTReadSet.put(method,read);
  methodToNTWriteSet.put(method,write);
  SootClass c=method.getDeclaringClass();
}

Fixed version (ground truth):
public void findNTRWSets(SootMethod method){
  if (methodToNTReadSet.containsKey(method) && methodToNTWriteSet.containsKey(method))   return;
  MethodRWSet read=null;
  MethodRWSet write=null;
  for (Iterator sIt=method.retrieveActiveBody().getUnits().iterator(); sIt.hasNext(); ) {
    final Stmt s=(Stmt)sIt.next();
    RWSet ntr=ntReadSet(method,s);
    if (ntr != null) {
      if (read == null)       read=new MethodRWSet();
      read.union(ntr);
    }
    RWSet ntw=ntWriteSet(method,s);
    if (ntw != null) {
      if (write == null)       write=new MethodRWSet();
      write.union(ntw);
    }
  }
  methodToNTReadSet.put(method,read);
  methodToNTWriteSet.put(method,write);
  SootClass c=method.getDeclaringClass();
}
Program: 88651
Project: 88651
Buggy source:
public RWSet writeSet(SootMethod method,Stmt stmt){
  RWSet ret=null;
  Iterator targets=tt.iterator(stmt);
  while (targets.hasNext()) {
    SootMethod target=(SootMethod)targets.next();
    if (target.isNative()) {
      if (ret == null)       ret=new SiteRWSet();
      ret.setCallsNative();
    }
 else     if (target.isConcrete()) {
      if (ret == null)       ret=new SiteRWSet();
      ret.union(nonTransitiveWriteSet(target));
    }
  }
  if (ret == null)   return ntWriteSet(method,stmt);
  ret.union(ntWriteSet(method,stmt));
  return ret;
}

Fixed version (ground truth):
public RWSet writeSet(SootMethod method,Stmt stmt){
  RWSet ret=null;
  Iterator targets=tt.iterator(stmt);
  while (targets.hasNext()) {
    SootMethod target=(SootMethod)targets.next();
    if (target.isNative()) {
      if (ret == null)       ret=new SiteRWSet();
      ret.setCallsNative();
    }
 else     if (target.isConcrete()) {
      RWSet ntw=nonTransitiveWriteSet(target);
      if (ntw != null) {
        if (ret == null)         ret=new SiteRWSet();
        ret.union(ntw);
      }
    }
  }
  if (ret == null)   return ntWriteSet(method,stmt);
  ret.union(ntWriteSet(method,stmt));
  return ret;
}
Program: 88652
Project: 88652
Buggy source:
public RWSet readSet(SootMethod method,Stmt stmt){
  RWSet ret=null;
  Iterator targets=tt.iterator(stmt);
  while (targets.hasNext()) {
    SootMethod target=(SootMethod)targets.next();
    if (target.isNative()) {
      if (ret == null)       ret=new SiteRWSet();
      ret.setCallsNative();
    }
 else     if (target.isConcrete()) {
      if (ret == null)       ret=new SiteRWSet();
      ret.union(nonTransitiveReadSet(target));
    }
  }
  if (ret == null)   return ntReadSet(method,stmt);
  ret.union(ntReadSet(method,stmt));
  return ret;
}

Fixed version (ground truth):
public RWSet readSet(SootMethod method,Stmt stmt){
  RWSet ret=null;
  Iterator targets=tt.iterator(stmt);
  while (targets.hasNext()) {
    SootMethod target=(SootMethod)targets.next();
    if (target.isNative()) {
      if (ret == null)       ret=new SiteRWSet();
      ret.setCallsNative();
    }
 else     if (target.isConcrete()) {
      RWSet ntr=nonTransitiveReadSet(target);
      if (ntr != null) {
        if (ret == null)         ret=new SiteRWSet();
        ret.union(ntr);
      }
    }
  }
  if (ret == null)   return ntReadSet(method,stmt);
  ret.union(ntReadSet(method,stmt));
  return ret;
}
Program: 88653
Project: 88653
Buggy source:
public String toString(){
  final StringBuffer ret=new StringBuffer();
  for (Iterator keyIt=sets.iterator(); keyIt.hasNext(); ) {
    final Object key=(Object)keyIt.next();
    ret.append(key.toString());
  }
  return ret.toString();
}

Fixed version (ground truth):
public String toString(){
  boolean empty=true;
  final StringBuffer ret=new StringBuffer();
  ret.append("String_Node_Str");
  for (Iterator keyIt=sets.iterator(); keyIt.hasNext(); ) {
    final Object key=(Object)keyIt.next();
    ret.append(key.toString());
    empty=false;
  }
  if (empty)   ret.append("String_Node_Str");
  return ret.toString();
}
Program: 88654
Project: 88654
Buggy source:
/** 
 * Find all the locals of reference type and all the types used in casts to initialize the mapping from locals and types to bits in the bit vector in LocalTypeSet. 
 */
protected void makeInitialSet(){
  Chain locals=((UnitGraph)graph).getBody().getLocals();
  List refLocals=new ArrayList();
  for (Iterator it=locals.iterator(); it.hasNext(); ) {
    Local l=(Local)it.next();
    if (l.getType() instanceof RefType) {
      refLocals.add(l);
    }
  }
  List types=new ArrayList();
  for (Iterator it=((UnitGraph)graph).getBody().getUnits().iterator(); it.hasNext(); ) {
    Stmt s=(Stmt)it.next();
    if (s instanceof AssignStmt) {
      AssignStmt as=(AssignStmt)s;
      Value rhs=as.getRightOp();
      if (rhs instanceof CastExpr) {
        Type t=((CastExpr)rhs).getCastType();
        if (t instanceof RefType && !types.contains(t)) {
          types.add(t);
        }
      }
    }
  }
  emptySet=new LocalTypeSet(refLocals,types);
}

Fixed version (ground truth):
/** 
 * Find all the locals of reference type and all the types used in casts to initialize the mapping from locals and types to bits in the bit vector in LocalTypeSet. 
 */
protected void makeInitialSet(){
  Chain locals=((UnitGraph)graph).getBody().getLocals();
  List refLocals=new ArrayList();
  for (Iterator lIt=locals.iterator(); lIt.hasNext(); ) {
    final Local l=(Local)lIt.next();
    if (l.getType() instanceof RefType) {
      refLocals.add(l);
    }
  }
  List types=new ArrayList();
  for (Iterator sIt=((UnitGraph)graph).getBody().getUnits().iterator(); sIt.hasNext(); ) {
    final Stmt s=(Stmt)sIt.next();
    if (s instanceof AssignStmt) {
      AssignStmt as=(AssignStmt)s;
      Value rhs=as.getRightOp();
      if (rhs instanceof CastExpr) {
        Type t=((CastExpr)rhs).getCastType();
        if (t instanceof RefType && !types.contains(t)) {
          types.add(t);
        }
      }
    }
  }
  emptySet=new LocalTypeSet(refLocals,types);
}
Program: 88656
Project: 88656
Buggy source:
/** 
 * Put the results of the analysis into tags in cast statements. 
 */
protected void tagCasts(){
  for (Iterator it=((UnitGraph)graph).getBody().getUnits().iterator(); it.hasNext(); ) {
    Stmt s=(Stmt)it.next();
    if (s instanceof AssignStmt) {
      AssignStmt as=(AssignStmt)s;
      Value rhs=as.getRightOp();
      if (rhs instanceof CastExpr) {
        CastExpr cast=(CastExpr)rhs;
        Type t=cast.getCastType();
        if (t instanceof RefType) {
          Local l=(Local)cast.getOp();
          LocalTypeSet set=(LocalTypeSet)unitToBeforeFlow.get(s);
          s.addTag(new CastCheckTag(set.get(set.indexOf(l,(RefType)t))));
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Put the results of the analysis into tags in cast statements. 
 */
protected void tagCasts(){
  for (Iterator sIt=((UnitGraph)graph).getBody().getUnits().iterator(); sIt.hasNext(); ) {
    final Stmt s=(Stmt)sIt.next();
    if (s instanceof AssignStmt) {
      AssignStmt as=(AssignStmt)s;
      Value rhs=as.getRightOp();
      if (rhs instanceof CastExpr) {
        CastExpr cast=(CastExpr)rhs;
        Type t=cast.getCastType();
        if (t instanceof RefType) {
          if (cast.getOp() instanceof Local) {
            Local l=(Local)cast.getOp();
            LocalTypeSet set=(LocalTypeSet)unitToBeforeFlow.get(s);
            s.addTag(new CastCheckTag(set.get(set.indexOf(l,(RefType)t))));
          }
 else {
            NullConstant nc=(NullConstant)cast.getOp();
            s.addTag(new CastCheckTag(true));
          }
        }
      }
    }
  }
}
Program: 88657
Project: 88657
Buggy source:
private soot.jimple.Constant getReturnConstant(polyglot.ast.Field field){
  if (field.fieldInstance().constantValue() instanceof String) {
    return soot.jimple.StringConstant.v((String)field.constantValue());
  }
 else   if (field.fieldInstance().constantValue() instanceof Boolean) {
    boolean val=((Boolean)field.constantValue()).booleanValue();
    return soot.jimple.IntConstant.v(val ? 1 : 0);
  }
 else   if (field.fieldInstance().constantValue() instanceof Character) {
    char val=((Character)field.constantValue()).charValue();
    return soot.jimple.IntConstant.v(val);
  }
 else {
    Number num=(Number)field.fieldInstance().constantValue();
    if (num instanceof Long) {
      return soot.jimple.LongConstant.v(((Long)num).longValue());
    }
 else     if (num instanceof Double) {
      return soot.jimple.DoubleConstant.v(((Double)num).doubleValue());
    }
 else     if (num instanceof Float) {
      return soot.jimple.FloatConstant.v(((Float)num).floatValue());
    }
 else {
      return soot.jimple.IntConstant.v(((Integer)num).intValue());
    }
  }
}

Fixed version (ground truth):
private soot.jimple.Constant getReturnConstant(polyglot.ast.Field field){
  System.out.println("String_Node_Str" + field);
  System.out.println("String_Node_Str" + field.type());
  System.out.println("String_Node_Str" + field.fieldInstance().constantValue().getClass());
  if (field.fieldInstance().constantValue() instanceof String) {
    return soot.jimple.StringConstant.v((String)field.constantValue());
  }
 else   if (field.fieldInstance().constantValue() instanceof Boolean) {
    boolean val=((Boolean)field.constantValue()).booleanValue();
    return soot.jimple.IntConstant.v(val ? 1 : 0);
  }
 else   if (field.fieldInstance().constantValue() instanceof Character) {
    char val=((Character)field.constantValue()).charValue();
    return soot.jimple.IntConstant.v(val);
  }
 else {
    Number num=(Number)field.fieldInstance().constantValue();
    num=createConstantCast(field.type(),num);
    if (num instanceof Long) {
      return soot.jimple.LongConstant.v(((Long)num).longValue());
    }
 else     if (num instanceof Double) {
      return soot.jimple.DoubleConstant.v(((Double)num).doubleValue());
    }
 else     if (num instanceof Float) {
      return soot.jimple.FloatConstant.v(((Float)num).floatValue());
    }
 else {
      return soot.jimple.IntConstant.v(((Integer)num).intValue());
    }
  }
}
Program: 88658
Project: 88658
Buggy source:
/** 
 * Cast Expression Creation
 */
private soot.Local getCastLocal(polyglot.ast.Cast castExpr){
  if (castExpr.expr().type().equals(castExpr.type())) {
    return (soot.Local)createExpr(castExpr.expr());
  }
  soot.Value val;
  if (castExpr.expr() instanceof polyglot.ast.Cast) {
    val=createExpr(((polyglot.ast.Cast)castExpr.expr()).expr());
  }
 else {
    val=createExpr(castExpr.expr());
  }
  soot.Type type=Util.getSootType(castExpr.type());
  soot.jimple.CastExpr cast=soot.jimple.Jimple.v().newCastExpr(val,type);
  Util.addLnPosTags(cast.getOpBox(),castExpr.expr().position());
  soot.Local retLocal=lg.generateLocal(cast.getCastType());
  soot.jimple.Stmt castAssign=soot.jimple.Jimple.v().newAssignStmt(retLocal,cast);
  body.getUnits().add(castAssign);
  Util.addLnPosTags(castAssign,castExpr.position());
  return retLocal;
}

Fixed version (ground truth):
/** 
 * Cast Expression Creation
 */
private soot.Value getCastLocal(polyglot.ast.Cast castExpr){
  if (castExpr.expr().type().equals(castExpr.type())) {
    return createExpr(castExpr.expr());
  }
  soot.Value val;
  if (castExpr.expr() instanceof polyglot.ast.Cast) {
    val=createExpr(((polyglot.ast.Cast)castExpr.expr()).expr());
  }
 else {
    val=createExpr(castExpr.expr());
  }
  soot.Type type=Util.getSootType(castExpr.type());
  soot.jimple.CastExpr cast=soot.jimple.Jimple.v().newCastExpr(val,type);
  Util.addLnPosTags(cast.getOpBox(),castExpr.expr().position());
  soot.Local retLocal=lg.generateLocal(cast.getCastType());
  soot.jimple.Stmt castAssign=soot.jimple.Jimple.v().newAssignStmt(retLocal,cast);
  body.getUnits().add(castAssign);
  Util.addLnPosTags(castAssign,castExpr.position());
  return retLocal;
}
Program: 88659
Project: 88659
Buggy source:
private soot.Local handlePrivateFieldSet(polyglot.ast.Assign assign){
  polyglot.ast.Field fLeft=(polyglot.ast.Field)assign.left();
  soot.Local leftLocal=(soot.Local)getFieldLocal(fLeft);
  soot.Value right=getAssignRightLocal(assign,leftLocal);
  soot.SootClass containClass=((soot.RefType)Util.getSootType(fLeft.target().type())).getSootClass();
  soot.SootMethod methToUse=addSetAccessMeth(containClass,fLeft,right);
  ArrayList params=new ArrayList();
  if (!fLeft.flags().isStatic()) {
    params.add(getThis(Util.getSootType(fLeft.target().type())));
  }
  params.add(right);
  soot.jimple.InvokeExpr invoke=soot.jimple.Jimple.v().newStaticInvokeExpr(methToUse,params);
  soot.Local retLocal=lg.generateLocal(right.getType());
  soot.jimple.AssignStmt assignStmt=soot.jimple.Jimple.v().newAssignStmt(retLocal,invoke);
  body.getUnits().add(assignStmt);
  return retLocal;
}

Fixed version (ground truth):
private soot.Local handlePrivateFieldSet(polyglot.ast.Assign assign){
  polyglot.ast.Field fLeft=(polyglot.ast.Field)assign.left();
  soot.Value right;
  if (assign.operator() == polyglot.ast.Assign.ASSIGN) {
    right=getSimpleAssignRightLocal(assign);
  }
 else   if ((assign.operator() == polyglot.ast.Assign.ADD_ASSIGN) && assign.type().toString().equals("String_Node_Str")) {
    right=getStringConcatAssignRightLocal(assign);
  }
 else {
    soot.Local leftLocal=(soot.Local)getFieldLocal(fLeft);
    right=getAssignRightLocal(assign,leftLocal);
  }
  soot.SootClass containClass=((soot.RefType)Util.getSootType(fLeft.target().type())).getSootClass();
  soot.SootMethod methToUse=addSetAccessMeth(containClass,fLeft,right);
  ArrayList params=new ArrayList();
  if (!fLeft.flags().isStatic()) {
    params.add(getThis(Util.getSootType(fLeft.target().type())));
  }
  params.add(right);
  soot.jimple.InvokeExpr invoke=soot.jimple.Jimple.v().newStaticInvokeExpr(methToUse,params);
  soot.Local retLocal=lg.generateLocal(right.getType());
  soot.jimple.AssignStmt assignStmt=soot.jimple.Jimple.v().newAssignStmt(retLocal,invoke);
  body.getUnits().add(assignStmt);
  return retLocal;
}
Program: 88661
Project: 88661
Buggy source:
public soot.Body getBody(soot.SootMethod sootMethod,String phaseName){
  soot.Body body=soot.jimple.Jimple.v().newBody(sootMethod);
  LocalGenerator lg=new LocalGenerator(body);
  soot.Local fieldBase=null;
  soot.Local assignLocal=null;
  int paramCounter=0;
  Iterator paramIt=sootMethod.getParameterTypes().iterator();
  while (paramIt.hasNext()) {
    soot.Type sootType=(soot.Type)paramIt.next();
    soot.Local paramLocal=lg.generateLocal(sootType);
    soot.jimple.ParameterRef paramRef=soot.jimple.Jimple.v().newParameterRef(sootType,paramCounter);
    soot.jimple.Stmt stmt=soot.jimple.Jimple.v().newIdentityStmt(paramLocal,paramRef);
    body.getUnits().add(stmt);
    if (paramCounter == 0) {
      fieldBase=paramLocal;
    }
    assignLocal=paramLocal;
    paramCounter++;
  }
  soot.SootField field=sootMethod.getDeclaringClass().getField(fieldName,fieldType);
  soot.jimple.FieldRef fieldRef=null;
  if (field.isStatic()) {
    fieldRef=soot.jimple.Jimple.v().newStaticFieldRef(field);
  }
 else {
    fieldRef=soot.jimple.Jimple.v().newInstanceFieldRef(fieldBase,field);
  }
  System.out.println("String_Node_Str" + fieldRef + "String_Node_Str"+ assignLocal);
  soot.jimple.AssignStmt assign=soot.jimple.Jimple.v().newAssignStmt(fieldRef,assignLocal);
  body.getUnits().add(assign);
  soot.jimple.Stmt retStmt=soot.jimple.Jimple.v().newReturnStmt(assignLocal);
  body.getUnits().add(retStmt);
  return body;
}

Fixed version (ground truth):
public soot.Body getBody(soot.SootMethod sootMethod,String phaseName){
  soot.Body body=soot.jimple.Jimple.v().newBody(sootMethod);
  LocalGenerator lg=new LocalGenerator(body);
  soot.Local fieldBase=null;
  soot.Local assignLocal=null;
  int paramCounter=0;
  Iterator paramIt=sootMethod.getParameterTypes().iterator();
  while (paramIt.hasNext()) {
    soot.Type sootType=(soot.Type)paramIt.next();
    soot.Local paramLocal=lg.generateLocal(sootType);
    soot.jimple.ParameterRef paramRef=soot.jimple.Jimple.v().newParameterRef(sootType,paramCounter);
    soot.jimple.Stmt stmt=soot.jimple.Jimple.v().newIdentityStmt(paramLocal,paramRef);
    body.getUnits().add(stmt);
    if (paramCounter == 0) {
      fieldBase=paramLocal;
    }
    assignLocal=paramLocal;
    paramCounter++;
  }
  soot.SootField field=sootMethod.getDeclaringClass().getField(fieldName,fieldType);
  soot.jimple.FieldRef fieldRef=null;
  if (field.isStatic()) {
    fieldRef=soot.jimple.Jimple.v().newStaticFieldRef(field);
  }
 else {
    fieldRef=soot.jimple.Jimple.v().newInstanceFieldRef(fieldBase,field);
  }
  soot.jimple.AssignStmt assign=soot.jimple.Jimple.v().newAssignStmt(fieldRef,assignLocal);
  body.getUnits().add(assign);
  soot.jimple.Stmt retStmt=soot.jimple.Jimple.v().newReturnStmt(assignLocal);
  body.getUnits().add(retStmt);
  return body;
}
Program: 88662
Project: 88662
Buggy source:
private static soot.Local getLocalOfType(soot.Body body,soot.Type type){
  soot.FastHierarchy fh=InitialResolver.v().hierarchy();
  Iterator it=body.getLocals().iterator();
  while (it.hasNext()) {
    soot.Local l=(soot.Local)it.next();
    if (!(l.getType() instanceof soot.PrimType) && fh.canStoreType(l.getType(),type)) {
      return l;
    }
  }
  return null;
}

Fixed version (ground truth):
private static soot.Local getLocalOfType(soot.Body body,soot.Type type){
  soot.FastHierarchy fh=InitialResolver.v().hierarchy();
  Iterator it=body.getLocals().iterator();
  while (it.hasNext()) {
    soot.Local l=(soot.Local)it.next();
    if (l.getType().equals(type)) {
      return l;
    }
  }
  return null;
}
Program: 88663
Project: 88663
Buggy source:
public static soot.Local getThis(soot.Type sootType,soot.Body body,HashMap getThisMap,LocalGenerator lg){
  if (InitialResolver.v().hierarchy() == null) {
    InitialResolver.v().hierarchy(new soot.FastHierarchy());
  }
  soot.FastHierarchy fh=InitialResolver.v().hierarchy();
  if (getThisMap.containsKey(sootType)) {
    return (soot.Local)getThisMap.get(sootType);
  }
  soot.Local specialThisLocal=body.getThisLocal();
  if (fh.canStoreType(specialThisLocal.getType(),sootType)) {
    getThisMap.put(sootType,specialThisLocal);
    return specialThisLocal;
  }
  if (bodyHasLocal(body,sootType)) {
    soot.Local l=getLocalOfType(body,sootType);
    getThisMap.put(sootType,l);
    return l;
  }
  soot.SootClass classToInvoke=((soot.RefType)specialThisLocal.getType()).getSootClass();
  soot.SootField outerThisField=classToInvoke.getFieldByName("String_Node_Str");
  soot.Local t1=lg.generateLocal(outerThisField.getType());
  soot.jimple.FieldRef fieldRef=soot.jimple.Jimple.v().newInstanceFieldRef(specialThisLocal,outerThisField);
  soot.jimple.AssignStmt fieldAssignStmt=soot.jimple.Jimple.v().newAssignStmt(t1,fieldRef);
  body.getUnits().add(fieldAssignStmt);
  if (fh.canStoreType(t1.getType(),sootType)) {
    getThisMap.put(sootType,t1);
    return t1;
  }
  soot.Local t2=t1;
  return getThisGivenOuter(sootType,getThisMap,body,lg,t2);
}

Fixed version (ground truth):
public static soot.Local getThis(soot.Type sootType,soot.Body body,HashMap getThisMap,LocalGenerator lg){
  if (InitialResolver.v().hierarchy() == null) {
    InitialResolver.v().hierarchy(new soot.FastHierarchy());
  }
  soot.FastHierarchy fh=InitialResolver.v().hierarchy();
  if (getThisMap.containsKey(sootType)) {
    return (soot.Local)getThisMap.get(sootType);
  }
  soot.Local specialThisLocal=body.getThisLocal();
  if (specialThisLocal.getType().equals(sootType)) {
    getThisMap.put(sootType,specialThisLocal);
    return specialThisLocal;
  }
  if (bodyHasLocal(body,sootType)) {
    soot.Local l=getLocalOfType(body,sootType);
    getThisMap.put(sootType,l);
    return l;
  }
  soot.SootClass classToInvoke=((soot.RefType)specialThisLocal.getType()).getSootClass();
  soot.SootField outerThisField=classToInvoke.getFieldByName("String_Node_Str");
  soot.Local t1=lg.generateLocal(outerThisField.getType());
  soot.jimple.FieldRef fieldRef=soot.jimple.Jimple.v().newInstanceFieldRef(specialThisLocal,outerThisField);
  soot.jimple.AssignStmt fieldAssignStmt=soot.jimple.Jimple.v().newAssignStmt(t1,fieldRef);
  body.getUnits().add(fieldAssignStmt);
  if (fh.canStoreType(t1.getType(),sootType)) {
    getThisMap.put(sootType,t1);
    return t1;
  }
  soot.Local t2=t1;
  return getThisGivenOuter(sootType,getThisMap,body,lg,t2);
}
Program: 88664
Project: 88664
Buggy source:
private static boolean bodyHasLocal(soot.Body body,soot.Type type){
  soot.FastHierarchy fh=InitialResolver.v().hierarchy();
  Iterator it=body.getLocals().iterator();
  while (it.hasNext()) {
    soot.Local l=(soot.Local)it.next();
    System.out.println("String_Node_Str" + l.getType() + "String_Node_Str"+ type);
    if (!(l.getType() instanceof soot.PrimType) && fh.canStoreType(l.getType(),type)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
private static boolean bodyHasLocal(soot.Body body,soot.Type type){
  soot.FastHierarchy fh=InitialResolver.v().hierarchy();
  Iterator it=body.getLocals().iterator();
  while (it.hasNext()) {
    soot.Local l=(soot.Local)it.next();
    if (l.getType().equals(type)) {
      return true;
    }
  }
  return false;
}