nus-yam/ex-repair huggingface dataset:
Program: 40476
Project: 40476
Buggy source:
private IMethod makeUnaryNumberCall(IClass cls){
  MethodReference ref=AstMethodReference.fnReference(JavaScriptTypes.Number);
  JavaScriptSummary S=new JavaScriptSummary(ref,2);
  S.addStatement(new JavaScriptStaticPropertyRead(4,2,"String_Node_Str"));
  CallSiteReference cs=new JSCallSiteReference(S.getNextProgramCounter());
  S.addStatement(new JavaScriptInvoke(4,5,new int[]{2},6,cs));
  S.addStatement(SSAInstructionFactory.ReturnInstruction(5,false));
  return new JavaScriptConstructor(ref,S,cls);
}

Fixed version (ground truth):
private IMethod makeUnaryNumberCall(IClass cls){
  MethodReference ref=AstMethodReference.fnReference(JavaScriptTypes.Number);
  JavaScriptSummary S=new JavaScriptSummary(ref,2);
  S.addStatement(new JavaScriptStaticPropertyRead(4,2,"String_Node_Str"));
  S.getNextProgramCounter();
  CallSiteReference cs=new JSCallSiteReference(S.getNextProgramCounter());
  S.addStatement(new JavaScriptInvoke(4,5,new int[]{2},6,cs));
  S.addStatement(SSAInstructionFactory.ReturnInstruction(5,false));
  S.getNextProgramCounter();
  return new JavaScriptConstructor(ref,S,cls);
}
Program: 40477
Project: 40477
Buggy source:
private IMethod makeNullaryStringCall(IClass cls){
  MethodReference ref=AstMethodReference.fnReference(JavaScriptTypes.String);
  JavaScriptSummary S=new JavaScriptSummary(ref,1);
  S.addConstant(new Integer(2),new ConstantValue("String_Node_Str"));
  S.addStatement(SSAInstructionFactory.ReturnInstruction(2,false));
  return new JavaScriptConstructor(ref,S,cls);
}

Fixed version (ground truth):
private IMethod makeNullaryStringCall(IClass cls){
  MethodReference ref=AstMethodReference.fnReference(JavaScriptTypes.String);
  JavaScriptSummary S=new JavaScriptSummary(ref,1);
  S.addConstant(new Integer(2),new ConstantValue("String_Node_Str"));
  S.addStatement(SSAInstructionFactory.ReturnInstruction(2,false));
  S.getNextProgramCounter();
  return new JavaScriptConstructor(ref,S,cls);
}
Program: 40478
Project: 40478
Buggy source:
private IMethod makeUnaryObjectConstructor(IClass cls){
  MethodReference ref=JavaScriptMethods.makeCtorReference(JavaScriptTypes.Object);
  JavaScriptSummary S=new JavaScriptSummary(ref,2);
  S.addStatement(SSAInstructionFactory.ReturnInstruction(2,false));
  return new JavaScriptConstructor(ref,S,cls);
}

Fixed version (ground truth):
private IMethod makeUnaryObjectConstructor(IClass cls){
  MethodReference ref=JavaScriptMethods.makeCtorReference(JavaScriptTypes.Object);
  JavaScriptSummary S=new JavaScriptSummary(ref,2);
  S.addStatement(SSAInstructionFactory.ReturnInstruction(2,false));
  S.getNextProgramCounter();
  return new JavaScriptConstructor(ref,S,cls);
}
Program: 40479
Project: 40479
Buggy source:
private IMethod makeArrayLengthConstructor(IClass cls){
  MethodReference ref=JavaScriptMethods.makeCtorReference(JavaScriptTypes.Array);
  JavaScriptSummary S=new JavaScriptSummary(ref,2);
  S.addStatement(new JavaScriptStaticPropertyRead(5,1,"String_Node_Str"));
  S.addStatement(new JavaScriptNewInstruction(6,NewSiteReference.make(S.getNextProgramCounter(),JavaScriptTypes.Array)));
  S.addStatement(new JavaScriptStaticPropertyWrite(6,"String_Node_Str",5));
  S.addStatement(new JavaScriptStaticPropertyWrite(6,"String_Node_Str",2));
  S.addStatement(SSAInstructionFactory.ReturnInstruction(6,false));
  return new JavaScriptConstructor(ref,S,cls);
}

Fixed version (ground truth):
private IMethod makeArrayLengthConstructor(IClass cls){
  MethodReference ref=JavaScriptMethods.makeCtorReference(JavaScriptTypes.Array);
  JavaScriptSummary S=new JavaScriptSummary(ref,2);
  S.addStatement(new JavaScriptStaticPropertyRead(5,1,"String_Node_Str"));
  S.getNextProgramCounter();
  S.addStatement(new JavaScriptNewInstruction(6,NewSiteReference.make(S.getNextProgramCounter(),JavaScriptTypes.Array)));
  S.addStatement(new JavaScriptStaticPropertyWrite(6,"String_Node_Str",5));
  S.getNextProgramCounter();
  S.addStatement(new JavaScriptStaticPropertyWrite(6,"String_Node_Str",2));
  S.getNextProgramCounter();
  S.addStatement(SSAInstructionFactory.ReturnInstruction(6,false));
  S.getNextProgramCounter();
  return new JavaScriptConstructor(ref,S,cls);
}
Program: 40480
Project: 40480
Buggy source:
private IMethod makeNullaryNumberCall(IClass cls){
  MethodReference ref=AstMethodReference.fnReference(JavaScriptTypes.Number);
  JavaScriptSummary S=new JavaScriptSummary(ref,1);
  S.addConstant(new Integer(2),new ConstantValue(0.0));
  S.addStatement(SSAInstructionFactory.ReturnInstruction(2,false));
  return new JavaScriptConstructor(ref,S,cls);
}

Fixed version (ground truth):
private IMethod makeNullaryNumberCall(IClass cls){
  MethodReference ref=AstMethodReference.fnReference(JavaScriptTypes.Number);
  JavaScriptSummary S=new JavaScriptSummary(ref,1);
  S.addConstant(new Integer(2),new ConstantValue(0.0));
  S.addStatement(SSAInstructionFactory.ReturnInstruction(2,false));
  S.getNextProgramCounter();
  return new JavaScriptConstructor(ref,S,cls);
}
Program: 40481
Project: 40481
Buggy source:
private IMethod makeNullaryObjectConstructor(IClass cls){
  MethodReference ref=JavaScriptMethods.makeCtorReference(JavaScriptTypes.Object);
  JavaScriptSummary S=new JavaScriptSummary(ref,1);
  S.addStatement(new JavaScriptStaticPropertyRead(4,1,"String_Node_Str"));
  S.addStatement(new JavaScriptNewInstruction(5,NewSiteReference.make(S.getNextProgramCounter(),JavaScriptTypes.Object)));
  S.addStatement(new JavaScriptStaticPropertyWrite(5,"String_Node_Str",4));
  S.addStatement(SSAInstructionFactory.ReturnInstruction(5,false));
  return new JavaScriptConstructor(ref,S,cls);
}

Fixed version (ground truth):
private IMethod makeNullaryObjectConstructor(IClass cls){
  MethodReference ref=JavaScriptMethods.makeCtorReference(JavaScriptTypes.Object);
  JavaScriptSummary S=new JavaScriptSummary(ref,1);
  S.addStatement(new JavaScriptStaticPropertyRead(4,1,"String_Node_Str"));
  S.getNextProgramCounter();
  S.addStatement(new JavaScriptNewInstruction(5,NewSiteReference.make(S.getNextProgramCounter(),JavaScriptTypes.Object)));
  S.addStatement(new JavaScriptStaticPropertyWrite(5,"String_Node_Str",4));
  S.getNextProgramCounter();
  S.addStatement(SSAInstructionFactory.ReturnInstruction(5,false));
  S.getNextProgramCounter();
  return new JavaScriptConstructor(ref,S,cls);
}
Program: 40482
Project: 40482
Buggy source:
private IMethod makeNullaryValueConstructor(IClass cls,Object value){
  MethodReference ref=JavaScriptMethods.makeCtorReference(cls.getReference());
  JavaScriptSummary S=new JavaScriptSummary(ref,1);
  S.addStatement(new JavaScriptStaticPropertyRead(4,1,"String_Node_Str"));
  S.addStatement(new JavaScriptNewInstruction(5,NewSiteReference.make(S.getNextProgramCounter(),cls.getReference())));
  S.addStatement(new JavaScriptStaticPropertyWrite(5,"String_Node_Str",4));
  S.addConstant(new Integer(8),new ConstantValue(value));
  S.addStatement(new JavaScriptStaticPropertyWrite(5,"String_Node_Str",8));
  S.addStatement(SSAInstructionFactory.ReturnInstruction(5,false));
  return new JavaScriptConstructor(ref,S,cls);
}

Fixed version (ground truth):
private IMethod makeNullaryValueConstructor(IClass cls,Object value){
  MethodReference ref=JavaScriptMethods.makeCtorReference(cls.getReference());
  JavaScriptSummary S=new JavaScriptSummary(ref,1);
  S.addStatement(new JavaScriptStaticPropertyRead(4,1,"String_Node_Str"));
  S.getNextProgramCounter();
  S.addStatement(new JavaScriptNewInstruction(5,NewSiteReference.make(S.getNextProgramCounter(),cls.getReference())));
  S.addStatement(new JavaScriptStaticPropertyWrite(5,"String_Node_Str",4));
  S.getNextProgramCounter();
  S.addConstant(new Integer(8),new ConstantValue(value));
  S.addStatement(new JavaScriptStaticPropertyWrite(5,"String_Node_Str",8));
  S.getNextProgramCounter();
  S.addStatement(SSAInstructionFactory.ReturnInstruction(5,false));
  S.getNextProgramCounter();
  return new JavaScriptConstructor(ref,S,cls);
}
Program: 40483
Project: 40483
Buggy source:
private IMethod makeUnaryStringCall(IClass cls){
  MethodReference ref=AstMethodReference.fnReference(JavaScriptTypes.String);
  JavaScriptSummary S=new JavaScriptSummary(ref,2);
  S.addStatement(new JavaScriptStaticPropertyRead(4,2,"String_Node_Str"));
  CallSiteReference cs=new JSCallSiteReference(S.getNextProgramCounter());
  S.addStatement(new JavaScriptInvoke(4,5,new int[]{2},6,cs));
  S.addStatement(SSAInstructionFactory.ReturnInstruction(5,false));
  return new JavaScriptConstructor(ref,S,cls);
}

Fixed version (ground truth):
private IMethod makeUnaryStringCall(IClass cls){
  MethodReference ref=AstMethodReference.fnReference(JavaScriptTypes.String);
  JavaScriptSummary S=new JavaScriptSummary(ref,2);
  S.addStatement(new JavaScriptStaticPropertyRead(4,2,"String_Node_Str"));
  S.getNextProgramCounter();
  CallSiteReference cs=new JSCallSiteReference(S.getNextProgramCounter());
  S.addStatement(new JavaScriptInvoke(4,5,new int[]{2},6,cs));
  S.addStatement(SSAInstructionFactory.ReturnInstruction(5,false));
  S.getNextProgramCounter();
  return new JavaScriptConstructor(ref,S,cls);
}
Program: 40484
Project: 40484
Buggy source:
private IMethod makeUnaryValueConstructor(IClass cls){
  MethodReference ref=JavaScriptMethods.makeCtorReference(cls.getReference());
  JavaScriptSummary S=new JavaScriptSummary(ref,2);
  S.addStatement(new JavaScriptStaticPropertyRead(5,1,"String_Node_Str"));
  S.addStatement(new JavaScriptNewInstruction(6,NewSiteReference.make(S.getNextProgramCounter(),cls.getReference())));
  S.addStatement(new JavaScriptStaticPropertyWrite(6,"String_Node_Str",5));
  S.addStatement(new JavaScriptStaticPropertyWrite(6,"String_Node_Str",2));
  S.addStatement(SSAInstructionFactory.ReturnInstruction(6,false));
  return new JavaScriptConstructor(ref,S,cls);
}

Fixed version (ground truth):
private IMethod makeUnaryValueConstructor(IClass cls){
  MethodReference ref=JavaScriptMethods.makeCtorReference(cls.getReference());
  JavaScriptSummary S=new JavaScriptSummary(ref,2);
  S.addStatement(new JavaScriptStaticPropertyRead(5,1,"String_Node_Str"));
  S.getNextProgramCounter();
  S.addStatement(new JavaScriptNewInstruction(6,NewSiteReference.make(S.getNextProgramCounter(),cls.getReference())));
  S.addStatement(new JavaScriptStaticPropertyWrite(6,"String_Node_Str",5));
  S.getNextProgramCounter();
  S.addStatement(new JavaScriptStaticPropertyWrite(6,"String_Node_Str",2));
  S.getNextProgramCounter();
  S.addStatement(SSAInstructionFactory.ReturnInstruction(6,false));
  S.getNextProgramCounter();
  return new JavaScriptConstructor(ref,S,cls);
}
Program: 40485
Project: 40485
Buggy source:
private IMethod makeFunctionObjectConstructor(IClass cls,int nargs){
  Object key=Pair.make(cls,new Integer(nargs));
  if (constructors.containsKey(key))   return constructors.get(key);
  MethodReference ref=JavaScriptMethods.makeCtorReference(cls.getReference());
  JavaScriptSummary S=new JavaScriptSummary(ref,nargs + 1);
  S.addStatement(new JavaScriptStaticPropertyRead(nargs + 4,1,"String_Node_Str"));
  S.addStatement(new JavaScriptNewInstruction(nargs + 5,NewSiteReference.make(S.getNextProgramCounter(),JavaScriptTypes.Object)));
  S.addStatement(new JavaScriptStaticPropertyWrite(nargs + 5,"String_Node_Str",nargs + 4));
  CallSiteReference cs=new JSCallSiteReference(S.getNextProgramCounter());
  int[] args=new int[nargs + 1];
  args[0]=nargs + 5;
  for (int i=0; i < nargs; i++)   args[i + 1]=i + 2;
  S.addStatement(new JavaScriptInvoke(1,nargs + 7,args,nargs + 8,cs));
  S.addStatement(SSAInstructionFactory.ReturnInstruction(nargs + 7,false));
  S.addStatement(SSAInstructionFactory.ReturnInstruction(nargs + 5,false));
  return record(key,new JavaScriptConstructor(ref,S,cls));
}

Fixed version (ground truth):
private IMethod makeFunctionObjectConstructor(IClass cls,int nargs){
  Object key=Pair.make(cls,new Integer(nargs));
  if (constructors.containsKey(key))   return constructors.get(key);
  MethodReference ref=JavaScriptMethods.makeCtorReference(cls.getReference());
  JavaScriptSummary S=new JavaScriptSummary(ref,nargs + 1);
  S.addStatement(new JavaScriptStaticPropertyRead(nargs + 4,1,"String_Node_Str"));
  S.getNextProgramCounter();
  S.addStatement(new JavaScriptNewInstruction(nargs + 5,NewSiteReference.make(S.getNextProgramCounter(),JavaScriptTypes.Object)));
  S.addStatement(new JavaScriptStaticPropertyWrite(nargs + 5,"String_Node_Str",nargs + 4));
  S.getNextProgramCounter();
  CallSiteReference cs=new JSCallSiteReference(S.getNextProgramCounter());
  int[] args=new int[nargs + 1];
  args[0]=nargs + 5;
  for (int i=0; i < nargs; i++)   args[i + 1]=i + 2;
  S.addStatement(new JavaScriptInvoke(1,nargs + 7,args,nargs + 8,cs));
  S.addStatement(SSAInstructionFactory.ReturnInstruction(nargs + 7,false));
  S.getNextProgramCounter();
  S.addStatement(SSAInstructionFactory.ReturnInstruction(nargs + 5,false));
  S.getNextProgramCounter();
  return record(key,new JavaScriptConstructor(ref,S,cls));
}
Program: 40486
Project: 40486
Buggy source:
private IMethod makeArrayContentsConstructor(IClass cls,int nargs){
  MethodReference ref=JavaScriptMethods.makeCtorReference(JavaScriptTypes.Array);
  JavaScriptSummary S=new JavaScriptSummary(ref,nargs + 1);
  S.addConstant(new Integer(nargs + 3),new ConstantValue("String_Node_Str"));
  S.addStatement(new JavaScriptPropertyRead(nargs + 4,1,nargs + 3));
  S.addStatement(new JavaScriptNewInstruction(nargs + 5,NewSiteReference.make(S.getNextProgramCounter(),JavaScriptTypes.Array)));
  S.addStatement(new JavaScriptStaticPropertyWrite(nargs + 5,"String_Node_Str",nargs + 4));
  S.addConstant(new Integer(nargs + 7),new ConstantValue(nargs));
  S.addStatement(new JavaScriptStaticPropertyWrite(nargs + 5,"String_Node_Str",nargs + 7));
  int vn=nargs + 9;
  for (int i=0; i < nargs; i++, vn+=2) {
    S.addConstant(new Integer(vn),new ConstantValue(i));
    S.addStatement(new JavaScriptPropertyWrite(nargs + 5,vn,i + 1));
  }
  S.addStatement(SSAInstructionFactory.ReturnInstruction(5,false));
  return new JavaScriptConstructor(ref,S,cls);
}

Fixed version (ground truth):
private IMethod makeArrayContentsConstructor(IClass cls,int nargs){
  MethodReference ref=JavaScriptMethods.makeCtorReference(JavaScriptTypes.Array);
  JavaScriptSummary S=new JavaScriptSummary(ref,nargs + 1);
  S.addConstant(new Integer(nargs + 3),new ConstantValue("String_Node_Str"));
  S.addStatement(new JavaScriptPropertyRead(nargs + 4,1,nargs + 3));
  S.getNextProgramCounter();
  S.addStatement(new JavaScriptNewInstruction(nargs + 5,NewSiteReference.make(S.getNextProgramCounter(),JavaScriptTypes.Array)));
  S.addStatement(new JavaScriptStaticPropertyWrite(nargs + 5,"String_Node_Str",nargs + 4));
  S.getNextProgramCounter();
  S.addConstant(new Integer(nargs + 7),new ConstantValue(nargs));
  S.addStatement(new JavaScriptStaticPropertyWrite(nargs + 5,"String_Node_Str",nargs + 7));
  S.getNextProgramCounter();
  int vn=nargs + 9;
  for (int i=0; i < nargs; i++, vn+=2) {
    S.addConstant(new Integer(vn),new ConstantValue(i));
    S.addStatement(new JavaScriptPropertyWrite(nargs + 5,vn,i + 1));
    S.getNextProgramCounter();
  }
  S.addStatement(SSAInstructionFactory.ReturnInstruction(5,false));
  S.getNextProgramCounter();
  return new JavaScriptConstructor(ref,S,cls);
}
Program: 40487
Project: 40487
Buggy source:
private void drainAndCatch(BufferedInputStream s,ByteArrayOutputStream b) throws IOException {
  while (s.available() > 0) {
    byte[] data=new byte[s.available()];
    int nRead=s.read(data);
    b.write(data,0,nRead);
  }
}

Fixed version (ground truth):
private void drainAndCatch(BufferedInputStream s,ByteArrayOutputStream b) throws IOException {
  try {
    while (s.available() > 0) {
      byte[] data=new byte[s.available()];
      int nRead=s.read(data);
      b.write(data,0,nRead);
    }
  }
 catch (  IOException e) {
  }
}
Program: 40488
Project: 40488
Buggy source:
private void drainAndPrint(BufferedInputStream s,PrintStream p) throws IOException {
  while (s.available() > 0) {
    byte[] data=new byte[s.available()];
    s.read(data);
    p.print(new String(data));
  }
}

Fixed version (ground truth):
private void drainAndPrint(BufferedInputStream s,PrintStream p) throws IOException {
  try {
    while (s.available() > 0) {
      byte[] data=new byte[s.available()];
      s.read(data);
      p.print(new String(data));
    }
  }
 catch (  IOException e) {
  }
}
Program: 40489
Project: 40489
Buggy source:
/** 
 * @return the IClass that represents the array element type, or null if theelement type is a primitive
 */
public IClass getElementClass(){
  TypeReference elementType=getReference().getArrayElementType();
  if (elementType.isPrimitiveType()) {
    return null;
  }
  return loader.lookupClass(elementType.getName());
}

Fixed version (ground truth):
/** 
 * @return the IClass that represents the array element type, or null if the element type is a primitive
 */
public IClass getElementClass(){
  TypeReference elementType=getReference().getArrayElementType();
  if (elementType.isPrimitiveType()) {
    return null;
  }
  return loader.lookupClass(elementType.getName());
}
Program: 40490
Project: 40490
Buggy source:
/** 
 * @return the IClass that represents the innermost array element type, ornull if the element type is a primitive
 */
public IClass getInnermostElementClass(){
  TypeReference elementType=getReference().getInnermostElementType();
  if (elementType.isPrimitiveType()) {
    return null;
  }
  return loader.lookupClass(elementType.getName());
}

Fixed version (ground truth):
/** 
 * @return the IClass that represents the innermost array element type, or null if the element type is a primitive
 */
public IClass getInnermostElementClass(){
  TypeReference elementType=getReference().getInnermostElementType();
  if (elementType.isPrimitiveType()) {
    return null;
  }
  return loader.lookupClass(elementType.getName());
}
Program: 40491
Project: 40491
Buggy source:
public Collection<IClass> getAllImplementedInterfaces(){
  HashSet<IClass> result=HashSetFactory.make(2);
  result.add(loader.lookupClass(TypeReference.array_interfaces[0]));
  result.add(loader.lookupClass(TypeReference.array_interfaces[1]));
  return result;
}

Fixed version (ground truth):
public Collection<IClass> getAllImplementedInterfaces(){
  HashSet<IClass> result=HashSetFactory.make(2);
  IClass klass=loader.lookupClass(TypeReference.array_interfaces[0]);
  if (klass != null) {
    result.add(klass);
  }
  klass=loader.lookupClass(TypeReference.array_interfaces[1]);
  if (klass != null) {
    result.add(klass);
  }
  return result;
}
Program: 40492
Project: 40492
Buggy source:
public Iterator<? extends T> getReturnSites(T c){
  return delegate.getCallSites(c);
}

Fixed version (ground truth):
public Iterator<? extends T> getReturnSites(T c,P callee){
  return delegate.getCallSites(c,callee);
}
Program: 40493
Project: 40493
Buggy source:
public Iterator<? extends T> getCallSites(T r){
  return delegate.getReturnSites(r);
}

Fixed version (ground truth):
public Iterator<? extends T> getCallSites(T r,P callee){
  return delegate.getReturnSites(r,callee);
}
Program: 40494
Project: 40494
Buggy source:
/** 
 * @return the blocks in the supergraph that represents exit nodes forprocedure p
 */
T[] getExitsForProcedure(P procedure);

Fixed version (ground truth):
/** 
 * @return the blocks in the supergraph that represents exit nodes for procedure p
 */
T[] getExitsForProcedure(P procedure);
Program: 40495
Project: 40495
Buggy source:
/** 
 * @param call a "call" node in the supergraph
 * @return an Iterator of nodes that are normal (non-call) successors of thiscall. This should only apply to backwards problems, where we might have, say, a call and a goto flow into a return site.
 */
Iterator<T> getNormalSuccessors(T call);

Fixed version (ground truth):
/** 
 * @param call a "call" node in the supergraph
 * @return an Iterator of nodes that are normal (non-call) successors of this call. This should only apply tobackwards problems, where we might have, say, a call and a goto flow into a return site.
 */
Iterator<T> getNormalSuccessors(T call);
Program: 40496
Project: 40496
Buggy source:
/** 
 * @param call a "call" node in the supergraph
 * @return the corresponding return nodes. There may be many, because ofexceptional control flow.
 */
Iterator<? extends T> getReturnSites(T call);

Fixed version (ground truth):
/** 
 * @param call a "call" node in the supergraph
 * @param callee a "called" "procedure" in the supergraph.  if callee is null, answer return sites for which no callee was found.
 * @return the corresponding return nodes. There may be many, because of exceptional control flow.
 */
Iterator<? extends T> getReturnSites(T call,P callee);
Program: 40497
Project: 40497
Buggy source:
/** 
 * @param r a "return" node in the supergraph
 * @return the corresponding call nodes. There may be many.
 */
Iterator<? extends T> getCallSites(T r);

Fixed version (ground truth):
/** 
 * @param r a "return" node in the supergraph
 * @param callee a "called" "procedure" in the supergraph.  if callee is null, answer return sites for which no callee was found.
 * @return the corresponding call nodes. There may be many.
 */
Iterator<? extends T> getCallSites(T ret,P callee);
Program: 40498
Project: 40498
Buggy source:
/** 
 * @return the blocks in the supergraph that represents entry nodes forprocedure p
 */
T[] getEntriesForProcedure(P procedure);

Fixed version (ground truth):
/** 
 * @return the blocks in the supergraph that represents entry nodes for procedure p
 */
T[] getEntriesForProcedure(P procedure);
Program: 40499
Project: 40499
Buggy source:
@SuppressWarnings("String_Node_Str") public Iterator<? extends Object> getReturnSites(Object object){
  if (object instanceof BasicBlockInContext) {
    return partialIPFG.getReturnSites((BasicBlockInContext)object);
  }
 else {
    CGNode n=nodeManager.getProcOfCollapsedNode(object);
    return new NonNullSingletonIterator<CollapsedNode>(nodeManager.getCollapsedExit(n));
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public Iterator<? extends Object> getReturnSites(Object object,CGNode callee){
  if (object instanceof BasicBlockInContext) {
    return partialIPFG.getReturnSites((BasicBlockInContext)object);
  }
 else {
    CGNode n=nodeManager.getProcOfCollapsedNode(object);
    return new NonNullSingletonIterator<CollapsedNode>(nodeManager.getCollapsedExit(n));
  }
}
Program: 40501
Project: 40501
Buggy source:
@SuppressWarnings("String_Node_Str") public Iterator<? extends Object> getSuccNodes(Object N){
  if (N instanceof IBasicBlock) {
    Set<Object> xverse=outgoingTransverseEdges.get(N);
    if (xverse == null) {
      return partialIPFG.getSuccNodes((BasicBlockInContext)N);
    }
 else {
      return new CompoundIterator<Object>(partialIPFG.getSuccNodes((BasicBlockInContext)N),xverse.iterator());
    }
  }
 else {
    if (isEntry(N)) {
      Set<Object> result=HashSetFactory.make(4);
      CGNode n=nodeManager.getProcOfCollapsedNode(N);
      for (Iterator it=cg.getSuccNodes(n); it.hasNext(); ) {
        CGNode s=(CGNode)it.next();
        if (!noCollapse.contains(s)) {
          result.add(nodeManager.getCollapsedEntry(s));
        }
      }
      result.add(nodeManager.getCollapsedExit(n));
      Set<Object> xverse=outgoingTransverseEdges.get(N);
      if (xverse != null) {
        result.addAll(xverse);
      }
      return result.iterator();
    }
 else {
      CGNode n=nodeManager.getProcOfCollapsedNode(N);
      Object entry=nodeManager.getCollapsedEntry(n);
      HashSet<Object> result=HashSetFactory.make(4);
      for (Iterator it=getPredNodes(entry); it.hasNext(); ) {
        Object callSite=it.next();
        for (Iterator returnSites=getReturnSites(callSite); returnSites.hasNext(); ) {
          result.add(returnSites.next());
        }
      }
      return result.iterator();
    }
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public Iterator<? extends Object> getSuccNodes(Object N){
  if (N instanceof IBasicBlock) {
    Set<Object> xverse=outgoingTransverseEdges.get(N);
    if (xverse == null) {
      return partialIPFG.getSuccNodes((BasicBlockInContext)N);
    }
 else {
      return new CompoundIterator<Object>(partialIPFG.getSuccNodes((BasicBlockInContext)N),xverse.iterator());
    }
  }
 else {
    if (isEntry(N)) {
      Set<Object> result=HashSetFactory.make(4);
      CGNode n=nodeManager.getProcOfCollapsedNode(N);
      for (Iterator it=cg.getSuccNodes(n); it.hasNext(); ) {
        CGNode s=(CGNode)it.next();
        if (!noCollapse.contains(s)) {
          result.add(nodeManager.getCollapsedEntry(s));
        }
      }
      result.add(nodeManager.getCollapsedExit(n));
      Set<Object> xverse=outgoingTransverseEdges.get(N);
      if (xverse != null) {
        result.addAll(xverse);
      }
      return result.iterator();
    }
 else {
      CGNode n=nodeManager.getProcOfCollapsedNode(N);
      Object entry=nodeManager.getCollapsedEntry(n);
      HashSet<Object> result=HashSetFactory.make(4);
      for (Iterator it=getPredNodes(entry); it.hasNext(); ) {
        Object callSite=it.next();
        for (Iterator returnSites=getReturnSites(callSite,n); returnSites.hasNext(); ) {
          result.add(returnSites.next());
        }
      }
      return result.iterator();
    }
  }
}
Program: 40502
Project: 40502
Buggy source:
@SuppressWarnings("String_Node_Str") public Iterator<? extends Object> getCallSites(Object object){
  if (object instanceof BasicBlockInContext) {
    return partialIPFG.getCallSites((BasicBlockInContext<ISSABasicBlock>)object);
  }
 else {
    CGNode n=nodeManager.getProcOfCollapsedNode(object);
    return new NonNullSingletonIterator<CollapsedNode>(nodeManager.getCollapsedEntry(n));
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public Iterator<? extends Object> getCallSites(Object object,CGNode callee){
  if (object instanceof BasicBlockInContext) {
    return partialIPFG.getCallSites((BasicBlockInContext<ISSABasicBlock>)object,callee);
  }
 else {
    CGNode n=nodeManager.getProcOfCollapsedNode(object);
    return new NonNullSingletonIterator<CollapsedNode>(nodeManager.getCollapsedEntry(n));
  }
}
Program: 40505
Project: 40505
Buggy source:
/** 
 * A debugging aid. TODO: move this elsewhere
 */
public static void clearSoftCaches(){
  float occupancy=1f - ((float)Runtime.getRuntime().freeMemory() / (float)Runtime.getRuntime().totalMemory());
  if (occupancy < OCCUPANCY_TRIGGER) {
    return;
  }
  if (getAnalysisCache() != null) {
    getAnalysisCache().getSSACache().wipe();
    getAnalysisCache().getCFGCache().wipe();
  }
  IClassHierarchy cha=getClassHierarchy();
  if (cha != null) {
    for (    IClass klass : cha) {
      if (klass instanceof ShrikeClass) {
        ShrikeClass c=(ShrikeClass)klass;
        c.clearSoftCaches();
      }
 else {
        for (Iterator it2=klass.getDeclaredMethods().iterator(); it2.hasNext(); ) {
          IMethod m=(IMethod)it2.next();
          if (m instanceof ShrikeCTMethod) {
            ((ShrikeCTMethod)m).clearCaches();
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * A debugging aid. TODO: move this elsewhere
 */
public static void clearSoftCaches(){
  float occupancy=1f - ((float)Runtime.getRuntime().freeMemory() / (float)Runtime.getRuntime().totalMemory());
  if (occupancy < OCCUPANCY_TRIGGER) {
    return;
  }
  AnalysisCache cache=getAnalysisCache();
  if (cache != null) {
    cache.getSSACache().wipe();
    cache.getCFGCache().wipe();
  }
  IClassHierarchy cha=getClassHierarchy();
  if (cha != null) {
    for (    IClass klass : cha) {
      if (klass instanceof ShrikeClass) {
        ShrikeClass c=(ShrikeClass)klass;
        c.clearSoftCaches();
      }
 else {
        for (Iterator it2=klass.getDeclaredMethods().iterator(); it2.hasNext(); ) {
          IMethod m=(IMethod)it2.next();
          if (m instanceof ShrikeCTMethod) {
            ((ShrikeCTMethod)m).clearCaches();
          }
        }
      }
    }
  }
}
Program: 40507
Project: 40507
Buggy source:
public Iterator<PointerKey> getWritesToInstanceField(PointerKey pk,IField f){
  if (f == ArrayContents.v()) {
    return getArrayWrites(pk);
  }
  Collection<MemoryAccess> writes=mam.getFieldWrites(pk,f);
  for (  MemoryAccess a : writes) {
    addSubgraphForNode(a.getNode());
  }
  ArrayList<PointerKey> written=new ArrayList<PointerKey>();
  for (  MemoryAccess a : writes) {
    IR ir=a.getNode().getIR();
    SSAPutInstruction s=(SSAPutInstruction)ir.getInstructions()[a.getInstructionIndex()];
    PointerKey r=heapModel.getPointerKeyForLocal(a.getNode(),s.getVal());
    written.add(r);
  }
  return written.iterator();
}

Fixed version (ground truth):
public Iterator<PointerKey> getWritesToInstanceField(PointerKey pk,IField f){
  if (f == ArrayContents.v()) {
    return getArrayWrites(pk);
  }
  Collection<MemoryAccess> writes=mam.getFieldWrites(pk,f);
  for (  MemoryAccess a : writes) {
    addSubgraphForNode(a.getNode());
  }
  ArrayList<PointerKey> written=new ArrayList<PointerKey>();
  for (  MemoryAccess a : writes) {
    IR ir=a.getNode().getIR();
    SSAPutInstruction s=(SSAPutInstruction)ir.getInstructions()[a.getInstructionIndex()];
    if (s == null) {
      continue;
    }
    PointerKey r=heapModel.getPointerKeyForLocal(a.getNode(),s.getVal());
    written.add(r);
  }
  return written.iterator();
}
Program: 40509
Project: 40509
Buggy source:
private void init(Graph<T> G,Iterator<? extends T> nodes){
  this.G=G;
  while (nodes.hasNext()) {
    T o=nodes.next();
    if (!visited.contains(o)) {
      Q.add(o);
      visited.add(o);
    }
  }
  index=0;
  T current=Q.get(0);
  visitChildren(current);
}

Fixed version (ground truth):
private void init(Graph<T> G,Iterator<? extends T> nodes){
  this.G=G;
  while (nodes.hasNext()) {
    T o=nodes.next();
    if (!visited.contains(o)) {
      Q.add(o);
      visited.add(o);
    }
  }
  index=0;
  if (Q.size() > 0) {
    T current=Q.get(0);
    visitChildren(current);
  }
}
Program: 40510
Project: 40510
Buggy source:
public Iterator<PointerKey> getReadsOfInstanceField(PointerKey pk,IField f){
  if (f == ArrayContents.v()) {
    return getArrayReads(pk);
  }
  Collection<MemoryAccess> reads=mam.getFieldReads(pk,f);
  for (  MemoryAccess a : reads) {
    addSubgraphForNode(a.getNode());
  }
  ArrayList<PointerKey> readInto=new ArrayList<PointerKey>();
  for (  MemoryAccess a : reads) {
    IR ir=a.getNode().getIR();
    SSAGetInstruction s=(SSAGetInstruction)ir.getInstructions()[a.getInstructionIndex()];
    PointerKey r=heapModel.getPointerKeyForLocal(a.getNode(),s.getDef());
    readInto.add(r);
  }
  return readInto.iterator();
}

Fixed version (ground truth):
public Iterator<PointerKey> getReadsOfInstanceField(PointerKey pk,IField f){
  if (f == ArrayContents.v()) {
    return getArrayReads(pk);
  }
  Collection<MemoryAccess> reads=mam.getFieldReads(pk,f);
  for (  MemoryAccess a : reads) {
    addSubgraphForNode(a.getNode());
  }
  ArrayList<PointerKey> readInto=new ArrayList<PointerKey>();
  for (  MemoryAccess a : reads) {
    IR ir=a.getNode().getIR();
    SSAGetInstruction s=(SSAGetInstruction)ir.getInstructions()[a.getInstructionIndex()];
    if (s == null) {
      continue;
    }
    PointerKey r=heapModel.getPointerKeyForLocal(a.getNode(),s.getDef());
    readInto.add(r);
  }
  return readInto.iterator();
}
Program: 40511
Project: 40511
Buggy source:
protected Iterator<PointerKey> getArrayReads(PointerKey arrayRef){
  Collection<MemoryAccess> arrayReads=mam.getArrayReads(arrayRef);
  for (Iterator<MemoryAccess> it=arrayReads.iterator(); it.hasNext(); ) {
    MemoryAccess a=it.next();
    addSubgraphForNode(a.getNode());
  }
  ArrayList<PointerKey> read=new ArrayList<PointerKey>();
  for (Iterator<MemoryAccess> it=arrayReads.iterator(); it.hasNext(); ) {
    MemoryAccess a=it.next();
    IR ir=a.getNode().getIR();
    SSAArrayLoadInstruction s=(SSAArrayLoadInstruction)ir.getInstructions()[a.getInstructionIndex()];
    PointerKey r=heapModel.getPointerKeyForLocal(a.getNode(),s.getDef());
    read.add(r);
  }
  return read.iterator();
}

Fixed version (ground truth):
protected Iterator<PointerKey> getArrayReads(PointerKey arrayRef){
  Collection<MemoryAccess> arrayReads=mam.getArrayReads(arrayRef);
  for (Iterator<MemoryAccess> it=arrayReads.iterator(); it.hasNext(); ) {
    MemoryAccess a=it.next();
    addSubgraphForNode(a.getNode());
  }
  ArrayList<PointerKey> read=new ArrayList<PointerKey>();
  for (Iterator<MemoryAccess> it=arrayReads.iterator(); it.hasNext(); ) {
    MemoryAccess a=it.next();
    IR ir=a.getNode().getIR();
    SSAArrayLoadInstruction s=(SSAArrayLoadInstruction)ir.getInstructions()[a.getInstructionIndex()];
    if (s == null) {
      continue;
    }
    PointerKey r=heapModel.getPointerKeyForLocal(a.getNode(),s.getDef());
    read.add(r);
  }
  return read.iterator();
}
Program: 40512
Project: 40512
Buggy source:
public void map(Object astType,CAstType castType){
  fMap.put(astType,castType);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public void map(Object astType,CAstType castType){
  fMap.put(astType,castType);
}
Program: 40513
Project: 40513
Buggy source:
@Override public int hashCode(){
  return method.hashCode();
}

Fixed version (ground truth):
@Override public int hashCode(){
  final int prime=31;
  int result=1;
  result=prime * result + ((declaringClass == null) ? 0 : declaringClass.hashCode());
  result=prime * result + ((method == null) ? 0 : method.hashCode());
  return result;
}
Program: 40514
Project: 40514
Buggy source:
@Override public boolean equals(Object obj){
  if (obj == null) {
    return false;
  }
  if (getClass().equals(obj.getClass())) {
    SyntheticMethod other=(SyntheticMethod)obj;
    return (method.equals(other.method));
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
@Override public boolean equals(Object obj){
  if (this == obj)   return true;
  if (obj == null)   return false;
  if (getClass() != obj.getClass())   return false;
  final SyntheticMethod other=(SyntheticMethod)obj;
  if (declaringClass == null) {
    if (other.declaringClass != null)     return false;
  }
 else   if (!declaringClass.equals(other.declaringClass))   return false;
  if (method == null) {
    if (other.method != null)     return false;
  }
 else   if (!method.equals(other.method))   return false;
  return true;
}
Program: 40515
Project: 40515
Buggy source:
@Override protected MachineState makeEdgeVariable(BasicBlock from,BasicBlock to){
  if (Assertions.verifyAssertions) {
    Assertions._assert(from != null);
    Assertions._assert(to != null);
  }
  MachineState result=new MachineState(71167 * (from.hashCode() + to.hashCode()),from);
  return result;
}

Fixed version (ground truth):
@Override protected MachineState makeEdgeVariable(BasicBlock from,BasicBlock to){
  if (Assertions.verifyAssertions) {
    Assertions._assert(from != null);
    Assertions._assert(to != null);
  }
  MachineState result=new MachineState(71167 * from.hashCode() + to.hashCode(),from);
  return result;
}
Program: 40517
Project: 40517
Buggy source:
/** 
 * Create nodes corresponding to <ul> <li> phi instructions <li> getCaughtExceptions </ul>
 */
private void createSpecialStatements(IR ir,Collection<SSAInstruction> visited){
  for (Iterator<SSAInstruction> it=ir.iterateAllInstructions(); it.hasNext(); ) {
    SSAInstruction s=it.next();
    if (s != null && !visited.contains(s)) {
      visited.add(s);
      if (s instanceof SSAPhiInstruction) {
        delegate.addNode(new PhiStatement(node,(SSAPhiInstruction)s));
      }
 else       if (s instanceof SSAGetCaughtExceptionInstruction) {
        delegate.addNode(new GetCaughtExceptionStatement(node,(SSAGetCaughtExceptionInstruction)s));
      }
 else       if (s instanceof SSAPiInstruction) {
        delegate.addNode(new PiStatement(node,(SSAPiInstruction)s));
      }
 else {
        Assertions.UNREACHABLE(s.toString());
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Create nodes corresponding to <ul> <li> phi instructions <li> getCaughtExceptions </ul>
 */
private void createSpecialStatements(IR ir){
  for (Iterator<SSAInstruction> it=ir.iterateAllInstructions(); it.hasNext(); ) {
    SSAInstruction s=it.next();
    if (s instanceof SSAPhiInstruction) {
      delegate.addNode(new PhiStatement(node,(SSAPhiInstruction)s));
    }
 else     if (s instanceof SSAGetCaughtExceptionInstruction) {
      delegate.addNode(new GetCaughtExceptionStatement(node,(SSAGetCaughtExceptionInstruction)s));
    }
 else     if (s instanceof SSAPiInstruction) {
      delegate.addNode(new PiStatement(node,(SSAPiInstruction)s));
    }
  }
}
Program: 40518
Project: 40518
Buggy source:
/** 
 * Create nodes in the graph corresponding to "normal" (bytecode) instructions
 */
private Collection<SSAInstruction> createNormalStatements(IR ir,Map<CGNode,OrdinalSet<PointerKey>> ref){
  Collection<SSAInstruction> visited=HashSetFactory.make();
  SSAInstruction[] instructions=ir.getInstructions();
  for (int i=0; i < instructions.length; i++) {
    SSAInstruction s=instructions[i];
    if (s instanceof SSAGetCaughtExceptionInstruction) {
      continue;
    }
    if (s != null) {
      delegate.addNode(new NormalStatement(node,i));
      visited.add(s);
    }
    if (s instanceof SSAAbstractInvokeInstruction) {
      addParamPassingStatements(i,ref,ir);
    }
  }
  return visited;
}

Fixed version (ground truth):
/** 
 * Create nodes in the graph corresponding to "normal" (bytecode) instructions
 */
private void createNormalStatements(IR ir,Map<CGNode,OrdinalSet<PointerKey>> ref){
  SSAInstruction[] instructions=ir.getInstructions();
  for (int i=0; i < instructions.length; i++) {
    SSAInstruction s=instructions[i];
    if (s instanceof SSAGetCaughtExceptionInstruction) {
      continue;
    }
    if (s != null) {
      delegate.addNode(new NormalStatement(node,i));
    }
    if (s instanceof SSAAbstractInvokeInstruction) {
      addParamPassingStatements(i,ref,ir);
    }
  }
}
Program: 40519
Project: 40519
Buggy source:
/** 
 * Create all nodes in this PDG. Each node is a Statement.
 */
private void createNodes(Map<CGNode,OrdinalSet<PointerKey>> ref,ControlDependenceOptions cOptions,IR ir){
  if (ir != null) {
    Collection<SSAInstruction> visited=createNormalStatements(ir,ref);
    createSpecialStatements(ir,visited);
  }
  createCalleeParams(ref);
  createReturnStatements();
  delegate.addNode(new MethodEntryStatement(node));
  delegate.addNode(new MethodExitStatement(node));
}

Fixed version (ground truth):
/** 
 * Create all nodes in this PDG. Each node is a Statement.
 */
private void createNodes(Map<CGNode,OrdinalSet<PointerKey>> ref,ControlDependenceOptions cOptions,IR ir){
  if (ir != null) {
    createNormalStatements(ir,ref);
    createSpecialStatements(ir);
  }
  createCalleeParams(ref);
  createReturnStatements();
  delegate.addNode(new MethodEntryStatement(node));
  delegate.addNode(new MethodExitStatement(node));
}
Program: 40520
Project: 40520
Buggy source:
private ResolutionFailure(CGNode node,Object ref){
  this(node,ref,null);
}

Fixed version (ground truth):
private ResolutionFailure(CGNode node,T ref){
  this(node,ref,null);
}
Program: 40521
Project: 40521
Buggy source:
@Override public int hashCode(){
  return getMethod().hashCode() * 8999 + ref.hashCode() * 8461 + getLevel();
}

Fixed version (ground truth):
@Override public int hashCode(){
  final int prime=31;
  int result=super.hashCode();
  result=prime * result + ((message == null) ? 0 : message.hashCode());
  result=prime * result + ((ref == null) ? 0 : ref.hashCode());
  return result;
}
Program: 40522
Project: 40522
Buggy source:
@Override public boolean equals(Object obj){
  if (obj == null) {
    return false;
  }
  if (getClass().equals(obj.getClass())) {
    ResolutionFailure other=(ResolutionFailure)obj;
    return (getMethod().equals(other.getMethod()) && getLevel() == other.getLevel() && ref.equals(other.ref));
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
@Override public boolean equals(Object obj){
  if (this == obj)   return true;
  if (!super.equals(obj))   return false;
  if (getClass() != obj.getClass())   return false;
  final ResolutionFailure other=(ResolutionFailure)obj;
  if (message == null) {
    if (other.message != null)     return false;
  }
 else   if (!message.equals(other.message))   return false;
  if (ref == null) {
    if (other.ref != null)     return false;
  }
 else   if (!ref.equals(other.ref))   return false;
  return true;
}
Program: 40523
Project: 40523
Buggy source:
public static ResolutionFailure create(CGNode node,Object ref,String msg) throws IllegalArgumentException {
  if (node == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  return new ResolutionFailure(node,ref,msg);
}

Fixed version (ground truth):
public static <T>ResolutionFailure create(CGNode node,T ref){
  if (node == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  return new ResolutionFailure<T>(node,ref);
}
Program: 40524
Project: 40524
Buggy source:
/** 
 * Does c implement i?
 * @return true iff i is an interface and c is a class that implements i, r cis an interface that extends i.
 */
public boolean implementsInterface(IClass c,IClass i){
  if (!i.isInterface()) {
    return false;
  }
  Set impls=implementors.get(i);
  if (impls != null && impls.contains(c)) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Does c implement i?
 * @return true iff i is an interface and c is a class that implements i, r c is an interface that extends i.
 */
public boolean implementsInterface(IClass c,IClass i){
  if (!i.isInterface()) {
    return false;
  }
  if (c.equals(i)) {
    return true;
  }
  Set impls=implementors.get(i);
  if (impls != null && impls.contains(c)) {
    return true;
  }
  return false;
}
Program: 40525
Project: 40525
Buggy source:
/** 
 * Get the targets for a method ref invoked on a class klass. The klass had better not be an interface.
 * @param ref method to invoke
 * @param klass declaringClass of receiver
 * @return Set the set of method implementations that might receive themessage
 */
private Set<IMethod> computeTargetsNotInterface(MethodReference ref,IClass klass){
  Node n=findNode(klass);
  HashSet<IMethod> result=HashSetFactory.make(3);
  if (n == null)   return result;
  Selector selector=ref.getSelector();
  IMethod resolved=resolveMethod(klass,selector);
  if (resolved != null) {
    result.add(resolved);
  }
  result.addAll(computeOverriders(n,selector));
  return result;
}

Fixed version (ground truth):
/** 
 * Get the targets for a method ref invoked on a class klass. The klass had better not be an interface.
 * @param ref method to invoke
 * @param klass declaringClass of receiver
 * @return Set the set of method implementations that might receive the message
 */
private Set<IMethod> computeTargetsNotInterface(MethodReference ref,IClass klass){
  Node n=findNode(klass);
  HashSet<IMethod> result=HashSetFactory.make(3);
  if (n == null)   return result;
  Selector selector=ref.getSelector();
  IMethod resolved=resolveMethod(klass,selector);
  if (resolved != null) {
    result.add(resolved);
  }
  result.addAll(computeOverriders(n,selector));
  return result;
}
Program: 40527
Project: 40527
Buggy source:
/** 
 * @return the canonical IField that represents a given field , or null ifnone found
 * @throws IllegalArgumentException if f is null
 * @throws IllegalArgumentException if klass is null
 */
public IField resolveField(IClass klass,FieldReference f){
  if (klass == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (f == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  return klass.getField(f.getName());
}

Fixed version (ground truth):
/** 
 * @return the canonical IField that represents a given field , or null if none found
 * @throws IllegalArgumentException if f is null
 * @throws IllegalArgumentException if klass is null
 */
public IField resolveField(IClass klass,FieldReference f){
  if (klass == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (f == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  return klass.getField(f.getName());
}
Program: 40528
Project: 40528
Buggy source:
private SSAInstruction[] makeStatements(JavaTypeContext context){
  ArrayList<SSAInstruction> statements=new ArrayList<SSAInstruction>();
  int nextLocal=1;
  int retValue=nextLocal++;
  TypeReference tr=context.getType().getTypeReference();
  if (tr != null) {
    SSALoadClassInstruction l=new SSALoadClassInstruction(retValue,tr);
    statements.add(l);
    SSAReturnInstruction R=new SSAReturnInstruction(retValue,false);
    statements.add(R);
  }
 else {
    SSAThrowInstruction t=new SSAThrowInstruction(retValue);
    statements.add(t);
  }
  SSAInstruction[] result=new SSAInstruction[statements.size()];
  Iterator<SSAInstruction> it=statements.iterator();
  for (int i=0; i < result.length; i++) {
    result[i]=it.next();
  }
  return result;
}

Fixed version (ground truth):
private SSAInstruction[] makeStatements(JavaTypeContext context){
  ArrayList<SSAInstruction> statements=new ArrayList<SSAInstruction>();
  int retValue=2;
  TypeReference tr=context.getType().getTypeReference();
  if (tr != null) {
    SSALoadClassInstruction l=new SSALoadClassInstruction(retValue,tr);
    statements.add(l);
    SSAReturnInstruction R=new SSAReturnInstruction(retValue,false);
    statements.add(R);
  }
 else {
    SSAThrowInstruction t=new SSAThrowInstruction(retValue);
    statements.add(t);
  }
  SSAInstruction[] result=new SSAInstruction[statements.size()];
  statements.toArray(result);
  return result;
}
Program: 40529
Project: 40529
Buggy source:
public boolean understands(CGNode node){
  if (node == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (!(node.getContext() instanceof JavaTypeContext))   return false;
  return node.getMethod().getReference().equals(CLASS_NEW_INSTANCE_REF);
}

Fixed version (ground truth):
public boolean understands(CGNode node){
  if (node == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (!(node.getContext() instanceof JavaTypeContext)) {
    return false;
  }
  return node.getMethod().getReference().equals(CLASS_NEW_INSTANCE_REF);
}
Program: 40530
Project: 40530
Buggy source:
public Context getCalleeTarget(CGNode caller,CallSiteReference site,IMethod callee,InstanceKey receiver){
  if (callee.getReference().equals(ClassNewInstanceContextInterpreter.CLASS_NEW_INSTANCE_REF) && isTypeConstant(receiver)) {
    IClass c=(IClass)((ConstantKey)receiver).getValue();
    return new JavaTypeContext(new PointType(c));
  }
  return null;
}

Fixed version (ground truth):
public Context getCalleeTarget(CGNode caller,CallSiteReference site,IMethod callee,InstanceKey receiver){
  if (callee.getReference().equals(ClassNewInstanceContextInterpreter.CLASS_NEW_INSTANCE_REF) && isTypeConstant(receiver)) {
    IClass c=(IClass)((ConstantKey)receiver).getValue();
    if (!c.isAbstract() && !c.isInterface()) {
      return new JavaTypeContext(new PointType(c));
    }
  }
  return null;
}
Program: 40531
Project: 40531
Buggy source:
/** 
 * Set up a method summary which allocates and returns an instance of concrete type T.
 * @param T
 */
private void addStatementsForConcreteType(final TypeReference T){
  int alloc=addStatementsForConcreteSimpleType(T);
  if (alloc == -1) {
    return;
  }
  if (T.isArrayType()) {
    MethodReference init=MethodReference.findOrCreate(T,MethodReference.initAtom,MethodReference.defaultInitDesc);
    CallSiteReference site=CallSiteReference.make(getCallSiteForType(T),init,IInvokeInstruction.Dispatch.SPECIAL);
    int[] params=new int[1];
    params[0]=alloc;
    int exc=getExceptionsForType(T);
    SSAInvokeInstruction s=new SSAInvokeInstruction(params,exc,site);
    calls.add(s);
    allInstructions.add(s);
  }
 else {
  }
}

Fixed version (ground truth):
/** 
 * Set up a method summary which allocates and returns an instance of concrete type T.
 * @param T
 */
private void addStatementsForConcreteType(final TypeReference T){
  int alloc=addStatementsForConcreteSimpleType(T);
  if (alloc == -1) {
    return;
  }
  if (T.isArrayType()) {
    MethodReference init=MethodReference.findOrCreate(T,MethodReference.initAtom,MethodReference.defaultInitDesc);
    CallSiteReference site=CallSiteReference.make(getCallSiteForType(T),init,IInvokeInstruction.Dispatch.SPECIAL);
    int[] params=new int[1];
    params[0]=alloc;
    int exc=getExceptionsForType(T);
    SSAInvokeInstruction s=new SSAInvokeInstruction(params,exc,site);
    calls.add(s);
    allInstructions.add(s);
  }
}