nus-yam/ex-repair huggingface dataset:
Program: 40797
Project: 40797
Buggy source:
String prettyPrint(IRelation r);

Fixed version (ground truth):
String prettyPrint(BinaryFormula binaryFormula);
Program: 40798
Project: 40798
Buggy source:
private static Disjunction toDisjunction(IFormula f){
switch (f.getKind()) {
case BINARY:
    AbstractBinaryFormula b=(AbstractBinaryFormula)f;
  if (b.getConnective().equals(BinaryConnective.OR)) {
    IFormula f1=b.getF1();
    Disjunction d2=toDisjunction(b.getF2());
    Collection<IFormula> c=HashSetFactory.make();
    c.add(f1);
    c.addAll(d2.getClauses());
    return Disjunction.make(c);
  }
 else {
    Assertions.UNREACHABLE(b.getConnective());
    return null;
  }
case CONSTANT:
case QUANTIFIED:
case RELATION:
return Disjunction.make(Collections.singleton(simplify(f)));
case NEGATION:
default :
Assertions.UNREACHABLE(f.getKind());
return null;
}
}

Fixed version (ground truth):
private static Disjunction toDisjunction(IFormula f){
switch (f.getKind()) {
case BINARY:
    AbstractBinaryFormula b=(AbstractBinaryFormula)f;
  if (b.getConnective().equals(BinaryConnective.OR)) {
    IFormula f1=b.getF1();
    Disjunction d2=toDisjunction(b.getF2());
    Collection<IFormula> c=HashSetFactory.make();
    c.add(f1);
    c.addAll(d2.getClauses());
    return Disjunction.make(c);
  }
 else {
    Assertions.UNREACHABLE(b.getConnective());
    return null;
  }
case CONSTANT:
case QUANTIFIED:
case RELATION:
case NEGATION:
return Disjunction.make(Collections.singleton(simplify(f)));
default :
Assertions.UNREACHABLE(f.getKind());
return null;
}
}
Program: 40799
Project: 40799
Buggy source:
public static IFormula make(IFormula f){
  if (f instanceof RelationFormula) {
    RelationFormula r=(RelationFormula)f;
    if (r.getRelation().equals(BinaryRelation.EQUALS)) {
      return RelationFormula.make(BinaryRelation.NE,r.getTerms());
    }
    if (r.getRelation().equals(BinaryRelation.NE)) {
      return RelationFormula.make(BinaryRelation.EQUALS,r.getTerms());
    }
    if (r.getRelation().equals(BinaryRelation.GE)) {
      return RelationFormula.make(BinaryRelation.LT,r.getTerms());
    }
    if (r.getRelation().equals(BinaryRelation.GT)) {
      return RelationFormula.make(BinaryRelation.LE,r.getTerms());
    }
    if (r.getRelation().equals(BinaryRelation.LE)) {
      return RelationFormula.make(BinaryRelation.GT,r.getTerms());
    }
    if (r.getRelation().equals(BinaryRelation.LT)) {
      return RelationFormula.make(BinaryRelation.GE,r.getTerms());
    }
  }
  return new NotFormula(f);
}

Fixed version (ground truth):
public static IFormula make(IFormula f){
switch (f.getKind()) {
case RELATION:
    RelationFormula r=(RelationFormula)f;
  if (r.getRelation().equals(BinaryRelation.EQUALS)) {
    return RelationFormula.make(BinaryRelation.NE,r.getTerms());
  }
if (r.getRelation().equals(BinaryRelation.NE)) {
  return RelationFormula.make(BinaryRelation.EQUALS,r.getTerms());
}
if (r.getRelation().equals(BinaryRelation.GE)) {
return RelationFormula.make(BinaryRelation.LT,r.getTerms());
}
if (r.getRelation().equals(BinaryRelation.GT)) {
return RelationFormula.make(BinaryRelation.LE,r.getTerms());
}
if (r.getRelation().equals(BinaryRelation.LE)) {
return RelationFormula.make(BinaryRelation.GT,r.getTerms());
}
if (r.getRelation().equals(BinaryRelation.LT)) {
return RelationFormula.make(BinaryRelation.GE,r.getTerms());
}
return new NotFormula(f);
case CONSTANT:
case BINARY:
case NEGATION:
case QUANTIFIED:
default :
return new NotFormula(f);
}
}
Program: 40801
Project: 40801
Buggy source:
/** 
 * map each SSAInstruction index to the NormalStatement which represents it.
 */
private static Map<Integer,NormalStatement> mapInstructionsToStatements(OrdinalSetMapping<Statement> domain){
  Map<Integer,NormalStatement> result=HashMapFactory.make();
  for (  Statement s : domain) {
    if (s.getKind().equals(Kind.NORMAL)) {
      NormalStatement n=(NormalStatement)s;
      System.err.println("String_Node_Str" + n.getInstructionIndex() + "String_Node_Str"+ n);
      result.put(n.getInstructionIndex(),n);
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * map each SSAInstruction index to the NormalStatement which represents it.
 */
private static Map<Integer,NormalStatement> mapInstructionsToStatements(OrdinalSetMapping<Statement> domain){
  Map<Integer,NormalStatement> result=HashMapFactory.make();
  for (  Statement s : domain) {
    if (s.getKind().equals(Kind.NORMAL)) {
      NormalStatement n=(NormalStatement)s;
      result.put(n.getInstructionIndex(),n);
    }
  }
  return result;
}
Program: 40802
Project: 40802
Buggy source:
/** 
 * Create nodes in the graph corresponding to "normal" (bytecode) instructions
 * @param options
 */
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) {
      addNode(new NormalStatement(node,i));
      visited.add(s);
    }
    if (s instanceof SSAAbstractInvokeInstruction) {
      addParamPassingStatements(i,ref);
    }
  }
  return visited;
}

Fixed version (ground truth):
/** 
 * 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) {
      addNode(new NormalStatement(node,i));
      visited.add(s);
    }
    if (s instanceof SSAAbstractInvokeInstruction) {
      addParamPassingStatements(i,ref);
    }
  }
  return visited;
}
Program: 40803
Project: 40803
Buggy source:
/** 
 * some code is required here in order to "hop-over" dead blocks that only contain null-instructions.
 * @param bb -basic block
 * @param instbb -an instruction basic-block (SingleInstructionBasicBlock)
 */
private void handleLastInstruction(BasicBlock bb,SingleInstructionBasicBlock instbb){
  Set<BBEdge> edgeWorkSet=HashSetFactory.make();
  if (!instbb.isPiBlock()) {
    for (Iterator sit=cfg.getSuccNodes(bb); sit.hasNext(); ) {
      BasicBlock succNode=(BasicBlock)sit.next();
      boolean fallThrough=isFallThroughEdge(bb,succNode);
      edgeWorkSet.add(new BBEdge(bb,succNode,fallThrough));
    }
  }
 else {
    SSAPiInstruction pi=(SSAPiInstruction)instbb.getInstruction();
    int succNum=pi.getSuccessor();
    BasicBlock succNode=(BasicBlock)cfg.getNode(succNum);
    boolean fallThrough=isFallThroughEdge(bb,succNode);
    edgeWorkSet.add(new BBEdge(bb,succNode,fallThrough));
  }
  if (bb.isExitBlock()) {
    addEdge(instbb,exitBlock);
  }
  while (!edgeWorkSet.isEmpty()) {
    Iterator workIt=edgeWorkSet.iterator();
    BBEdge edge=(BBEdge)workIt.next();
    boolean fallThru=false;
    if (isFallThroughEdge(edge.src,edge.dest)) {
      fallThru=true;
    }
    workIt.remove();
    if (edge.dest.isEntryBlock()) {
      addEdge(instbb,entryBlock);
      if (fallThru) {
        fallThroughTargets.put(instbb,entryBlock);
      }
    }
 else     if (edge.dest.isExitBlock()) {
      if (basicBlockHasNonNullInstruction(edge.dest)) {
        SSAInstruction succInst=getBasicBlockEntry(edge.dest);
        SingleInstructionBasicBlock succBlock=getInstructionBlock(succInst);
        addEdge(instbb,succBlock);
        if (fallThru) {
          fallThroughTargets.put(instbb,succBlock);
        }
      }
 else {
        addEdge(instbb,exitBlock);
        if (fallThru) {
          fallThroughTargets.put(instbb,exitBlock);
        }
      }
    }
 else     if (basicBlockHasNonNullInstruction(edge.dest)) {
      SSAInstruction succInst=getBasicBlockEntry(edge.dest);
      SingleInstructionBasicBlock succBlock=getInstructionBlock(succInst);
      addEdge(instbb,succBlock);
      if (fallThru) {
        fallThroughTargets.put(instbb,succBlock);
      }
    }
 else {
      for (Iterator sit=cfg.getSuccNodes(edge.dest); sit.hasNext(); ) {
        BasicBlock succNode=(BasicBlock)sit.next();
        edgeWorkSet.add(new BBEdge(bb,succNode,edge.isFallThrough));
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * some code is required here in order to "hop-over" dead blocks that only contain null-instructions.
 * @param bb -basic block
 * @param instbb -an instruction basic-block (SingleInstructionBasicBlock)
 */
private void handleLastInstruction(BasicBlock bb,SingleInstructionBasicBlock instbb){
}
Program: 40804
Project: 40804
Buggy source:
/** 
 * process a basic block that does not have pi nodes
 * @param bb -basic block
 * @param blockInstructionArray -instructions of the basic-block
 */
private void processNoPi(BasicBlock bb,Object[] blockInstructionArray){
  int size=blockInstructionArray.length;
  for (int i=0; i < size; i++) {
    SSAInstruction inst=(SSAInstruction)blockInstructionArray[i];
    Assertions.productionAssertion(inst != null);
    SingleInstructionBasicBlock currBlock=getInstructionBlock(inst);
    if (i < size - 1) {
      SSAInstruction nextInst=(SSAInstruction)blockInstructionArray[i + 1];
      Assertions.productionAssertion(nextInst != null);
      SingleInstructionBasicBlock nextBlock=getInstructionBlock(nextInst);
      addEdge(currBlock,nextBlock);
      fallThroughTargets.put(currBlock,nextBlock);
    }
 else {
      handleLastInstruction(bb,currBlock);
    }
  }
}

Fixed version (ground truth):
/** 
 * process a basic block that does not have pi nodes
 * @param bb -basic block
 * @param blockInstructionArray -instructions of the basic-block
 */
private void processNoPi(BasicBlock bb,Object[] blockInstructionArray){
  int size=blockInstructionArray.length;
  for (int i=0; i < size; i++) {
    SSAInstruction inst=(SSAInstruction)blockInstructionArray[i];
    Assertions.productionAssertion(inst != null);
    SingleInstructionBasicBlock currBlock=getInstructionBlock(inst);
    if (currBlock == null) {
      Assertions.UNREACHABLE("String_Node_Str" + inst);
    }
    if (i < size - 1) {
      SSAInstruction nextInst=(SSAInstruction)blockInstructionArray[i + 1];
      Assertions.productionAssertion(nextInst != null);
      SingleInstructionBasicBlock nextBlock=getInstructionBlock(nextInst);
      addEdge(currBlock,nextBlock);
      fallThroughTargets.put(currBlock,nextBlock);
    }
 else {
      handleLastInstruction(bb,currBlock);
    }
  }
}
Program: 40807
Project: 40807
Buggy source:
/** 
 * map each SSAInstruction to the NormalStatement which represents it.
 */
private static Map<SSAInstruction,NormalStatement> mapInstructionsToStatements(OrdinalSetMapping<Statement> domain){
  Map<SSAInstruction,NormalStatement> ssaInstruction2Statement=HashMapFactory.make();
  for (  Statement s : domain) {
    if (s.getKind().equals(Kind.NORMAL)) {
      NormalStatement n=(NormalStatement)s;
      ssaInstruction2Statement.put(n.getInstruction(),n);
    }
  }
  return ssaInstruction2Statement;
}

Fixed version (ground truth):
/** 
 * map each SSAInstruction index to the NormalStatement which represents it.
 */
private static Map<Integer,NormalStatement> mapInstructionsToStatements(OrdinalSetMapping<Statement> domain){
  Map<Integer,NormalStatement> result=HashMapFactory.make();
  for (  Statement s : domain) {
    if (s.getKind().equals(Kind.NORMAL)) {
      NormalStatement n=(NormalStatement)s;
      System.err.println("String_Node_Str" + n.getInstructionIndex() + "String_Node_Str"+ n);
      result.put(n.getInstructionIndex(),n);
    }
  }
  return result;
}
Program: 40808
Project: 40808
Buggy source:
private void initHeapReturnCaller(){
  for (  Statement s : domain) {
    if (s.getKind().equals(Kind.HEAP_RET_CALLER)) {
      HeapStatement.ReturnCaller r=(ReturnCaller)s;
      NormalStatement call=ssaInstruction2Statement.get(r.getCall());
      int i=domain.getMappedIndex(call);
      int j=domain.getMappedIndex(r);
      heapReturnCaller.add(i,j);
    }
  }
}

Fixed version (ground truth):
private void initHeapReturnCaller(){
  for (  Statement s : domain) {
    if (s.getKind().equals(Kind.HEAP_RET_CALLER)) {
      HeapStatement.ReturnCaller r=(ReturnCaller)s;
      NormalStatement call=ssaInstructionIndex2Statement.get(r.getCallIndex());
      int i=domain.getMappedIndex(call);
      int j=domain.getMappedIndex(r);
      heapReturnCaller.add(i,j);
    }
  }
}
Program: 40809
Project: 40809
Buggy source:
/** 
 * @return int set representing the heap def statements that are gen'ed bythe basic block. null if none.
 */
IntSet gen(SingleInstructionBasicBlock b){
  if (b.isEntryBlock()) {
    return heapEntryStatements();
  }
 else {
    SSAInstruction s=b.getInstruction();
    if (s == null) {
      return null;
    }
 else {
      if (s instanceof SSAInvokeInstruction) {
        return heapReturnCaller.getRelated(domain.getMappedIndex(ssaInstruction2Statement.get(s)));
      }
 else {
        Collection<PointerKey> gen=ModRef.getMod(node,h,pa,s,exclusions);
        if (gen.isEmpty()) {
          return null;
        }
 else {
          NormalStatement n=ssaInstruction2Statement.get(s);
          return SparseIntSet.singleton(domain.getMappedIndex(n));
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * @return int set representing the heap def statements that are gen'ed bythe basic block. null if none.
 */
IntSet gen(SingleInstructionBasicBlock b){
  if (b.isEntryBlock()) {
    return heapEntryStatements();
  }
 else {
    SSAInstruction s=b.getInstruction();
    if (s == null) {
      return null;
    }
 else {
      if (s instanceof SSAInvokeInstruction) {
        Statement st=ssaInstructionIndex2Statement.get(b.getLastInstructionIndex());
        if (st == null) {
          System.err.println(ssaInstructionIndex2Statement);
          Assertions.UNREACHABLE("String_Node_Str" + b + "String_Node_Str"+ b.getLastInstructionIndex()+ "String_Node_Str"+ s);
        }
        int domainIndex=domain.getMappedIndex(st);
        assert(domainIndex != -1);
        return heapReturnCaller.getRelated(domainIndex);
      }
 else {
        Collection<PointerKey> gen=ModRef.getMod(node,h,pa,s,exclusions);
        if (gen.isEmpty()) {
          return null;
        }
 else {
          NormalStatement n=ssaInstructionIndex2Statement.get(b.getLastInstructionIndex());
          return SparseIntSet.singleton(domain.getMappedIndex(n));
        }
      }
    }
  }
}
Program: 40810
Project: 40810
Buggy source:
RDMap(BitVectorSolver<IBasicBlock> solver,OrdinalSetMapping<Statement> domain,CGNode node,ExtendedHeapModel h,PointerAnalysis pa,Map<CGNode,OrdinalSet<PointerKey>> mod,ExpandedControlFlowGraph cfg,Map<SSAInstruction,NormalStatement> ssaInstruction2Statement,HeapExclusions exclusions){
  if (VERBOSE) {
    System.err.println("String_Node_Str");
  }
  this.exclusions=exclusions;
  Map<PointerKey,MutableIntSet> pointerKeyMod=initPointerKeyMod(domain,node,h,pa);
  if (VERBOSE) {
    System.err.println("String_Node_Str");
  }
  eagerPopulate(pointerKeyMod,solver,domain,node,h,pa,mod,cfg,ssaInstruction2Statement);
  if (VERBOSE) {
    System.err.println("String_Node_Str");
  }
}

Fixed version (ground truth):
RDMap(BitVectorSolver<IBasicBlock> solver,OrdinalSetMapping<Statement> domain,CGNode node,ExtendedHeapModel h,PointerAnalysis pa,Map<CGNode,OrdinalSet<PointerKey>> mod,ExpandedControlFlowGraph cfg,Map<Integer,NormalStatement> ssaInstructionIndex2Statement,HeapExclusions exclusions){
  if (VERBOSE) {
    System.err.println("String_Node_Str");
  }
  this.exclusions=exclusions;
  Map<PointerKey,MutableIntSet> pointerKeyMod=initPointerKeyMod(domain,node,h,pa);
  if (VERBOSE) {
    System.err.println("String_Node_Str");
  }
  eagerPopulate(pointerKeyMod,solver,domain,node,h,pa,mod,cfg,ssaInstructionIndex2Statement);
  if (VERBOSE) {
    System.err.println("String_Node_Str");
  }
}
Program: 40811
Project: 40811
Buggy source:
private void eagerPopulate(Map<PointerKey,MutableIntSet> pointerKeyMod,BitVectorSolver<IBasicBlock> solver,OrdinalSetMapping<Statement> domain,CGNode node,ExtendedHeapModel h,PointerAnalysis pa,Map<CGNode,OrdinalSet<PointerKey>> mod,ExpandedControlFlowGraph cfg,Map<SSAInstruction,NormalStatement> ssaInstruction2Statement){
  for (  Statement s : domain) {
    delegate.put(s,computeResult(s,pointerKeyMod,solver,domain,node,h,pa,mod,cfg,ssaInstruction2Statement));
  }
}

Fixed version (ground truth):
private void eagerPopulate(Map<PointerKey,MutableIntSet> pointerKeyMod,BitVectorSolver<IBasicBlock> solver,OrdinalSetMapping<Statement> domain,CGNode node,ExtendedHeapModel h,PointerAnalysis pa,Map<CGNode,OrdinalSet<PointerKey>> mod,ExpandedControlFlowGraph cfg,Map<Integer,NormalStatement> ssaInstruction2Statement){
  for (  Statement s : domain) {
    delegate.put(s,computeResult(s,pointerKeyMod,solver,domain,node,h,pa,mod,cfg,ssaInstruction2Statement));
  }
}
Program: 40812
Project: 40812
Buggy source:
/** 
 * For each statement s, compute the set of statements that may def the heap value read by s.
 * @param mod
 * @param ssaInstruction2Statement
 */
private static Map<Statement,OrdinalSet<Statement>> makeResult(BitVectorSolver<IBasicBlock> solver,OrdinalSetMapping<Statement> domain,CGNode node,ExtendedHeapModel h,PointerAnalysis pa,Map<CGNode,OrdinalSet<PointerKey>> mod,ExpandedControlFlowGraph cfg,Map<SSAInstruction,NormalStatement> ssaInstruction2Statement,HeapExclusions exclusions){
  return new RDMap(solver,domain,node,h,pa,mod,cfg,ssaInstruction2Statement,exclusions);
}

Fixed version (ground truth):
/** 
 * For each statement s, compute the set of statements that may def the heap value read by s.
 */
private static Map<Statement,OrdinalSet<Statement>> makeResult(BitVectorSolver<IBasicBlock> solver,OrdinalSetMapping<Statement> domain,CGNode node,ExtendedHeapModel h,PointerAnalysis pa,Map<CGNode,OrdinalSet<PointerKey>> mod,ExpandedControlFlowGraph cfg,Map<Integer,NormalStatement> ssaInstructionIndex2Statement,HeapExclusions exclusions){
  return new RDMap(solver,domain,node,h,pa,mod,cfg,ssaInstructionIndex2Statement,exclusions);
}
Program: 40813
Project: 40813
Buggy source:
public RD(CGNode node,ExpandedControlFlowGraph cfg,PointerAnalysis pa,OrdinalSetMapping<Statement> domain,Map<SSAInstruction,NormalStatement> ssaInstruction2Statement,HeapExclusions exclusions){
  this.node=node;
  this.cfg=cfg;
  this.domain=domain;
  this.pa=pa;
  this.h=new DelegatingExtendedHeapModel(pa.getHeapModel());
  this.ssaInstruction2Statement=ssaInstruction2Statement;
  this.exclusions=exclusions;
  initHeapReturnCaller();
}

Fixed version (ground truth):
public RD(CGNode node,ExpandedControlFlowGraph cfg,PointerAnalysis pa,OrdinalSetMapping<Statement> domain,Map<Integer,NormalStatement> ssaInstructionIndex2Statement,HeapExclusions exclusions){
  this.node=node;
  this.cfg=cfg;
  this.domain=domain;
  this.pa=pa;
  this.h=new DelegatingExtendedHeapModel(pa.getHeapModel());
  this.ssaInstructionIndex2Statement=ssaInstructionIndex2Statement;
  this.exclusions=exclusions;
  initHeapReturnCaller();
}
Program: 40815
Project: 40815
Buggy source:
public ParamCaller(CGNode node,SSAAbstractInvokeInstruction call,PointerKey loc){
  super(node,loc);
  this.call=call;
}

Fixed version (ground truth):
public ParamCaller(CGNode node,int callIndex,PointerKey loc){
  super(node,loc);
  this.callIndex=callIndex;
}
Program: 40816
Project: 40816
Buggy source:
public SSAAbstractInvokeInstruction getCall(){
  return call;
}

Fixed version (ground truth):
public SSAAbstractInvokeInstruction getCall(){
  return (SSAAbstractInvokeInstruction)getNode().getIR().getInstructions()[callIndex];
}
Program: 40817
Project: 40817
Buggy source:
public ReturnCaller(CGNode node,SSAAbstractInvokeInstruction call,PointerKey loc){
  super(node,loc);
  this.call=call;
}

Fixed version (ground truth):
public ReturnCaller(CGNode node,int callIndex,PointerKey loc){
  super(node,loc);
  this.callIndex=callIndex;
}
Program: 40818
Project: 40818
Buggy source:
/** 
 * Create nodes in the graph corresponding to in/out parameter passing for a call instruction
 * @param dOptions
 */
private void addParamPassingStatements(SSAAbstractInvokeInstruction call,Map<CGNode,OrdinalSet<PointerKey>> ref){
  Collection<Statement> params=MapUtil.findOrCreateSet(callerParamStatements,call.getCallSite());
  Collection<Statement> rets=MapUtil.findOrCreateSet(callerReturnStatements,call.getCallSite());
  for (int j=0; j < call.getNumberOfUses(); j++) {
    Statement st=new ParamStatement.ParamCaller(node,call,call.getUse(j));
    addNode(st);
    params.add(st);
  }
  if (!call.getDeclaredResultType().equals(TypeReference.Void)) {
    Statement st=new ParamStatement.NormalReturnCaller(node,call);
    addNode(st);
    rets.add(st);
  }
{
    if (!dOptions.isIgnoreExceptions()) {
      Statement st=new ParamStatement.ExceptionalReturnCaller(node,call);
      addNode(st);
      rets.add(st);
    }
  }
  if (!dOptions.isIgnoreHeap()) {
    OrdinalSet<PointerKey> uref=unionHeapLocations(node,call,ref);
    for (    PointerKey p : uref) {
      Statement st=new HeapStatement.ParamCaller(node,call,p);
      addNode(st);
      params.add(st);
    }
    OrdinalSet<PointerKey> umod=unionHeapLocations(node,call,mod);
    for (    PointerKey p : umod) {
      Statement st=new HeapStatement.ReturnCaller(node,call,p);
      addNode(st);
      rets.add(st);
    }
  }
}

Fixed version (ground truth):
/** 
 * Create nodes in the graph corresponding to in/out parameter passing for a call instruction
 */
private void addParamPassingStatements(int callIndex,Map<CGNode,OrdinalSet<PointerKey>> ref){
  SSAAbstractInvokeInstruction call=(SSAAbstractInvokeInstruction)node.getIR().getInstructions()[callIndex];
  Collection<Statement> params=MapUtil.findOrCreateSet(callerParamStatements,call.getCallSite());
  Collection<Statement> rets=MapUtil.findOrCreateSet(callerReturnStatements,call.getCallSite());
  for (int j=0; j < call.getNumberOfUses(); j++) {
    Statement st=new ParamStatement.ParamCaller(node,call,call.getUse(j));
    addNode(st);
    params.add(st);
  }
  if (!call.getDeclaredResultType().equals(TypeReference.Void)) {
    Statement st=new ParamStatement.NormalReturnCaller(node,call);
    addNode(st);
    rets.add(st);
  }
{
    if (!dOptions.isIgnoreExceptions()) {
      Statement st=new ParamStatement.ExceptionalReturnCaller(node,call);
      addNode(st);
      rets.add(st);
    }
  }
  if (!dOptions.isIgnoreHeap()) {
    OrdinalSet<PointerKey> uref=unionHeapLocations(node,call,ref);
    for (    PointerKey p : uref) {
      Statement st=new HeapStatement.ParamCaller(node,callIndex,p);
      addNode(st);
      params.add(st);
    }
    OrdinalSet<PointerKey> umod=unionHeapLocations(node,call,mod);
    for (    PointerKey p : umod) {
      Statement st=new HeapStatement.ReturnCaller(node,callIndex,p);
      addNode(st);
      rets.add(st);
    }
  }
}
Program: 40819
Project: 40819
Buggy source:
/** 
 * Create nodes in the graph corresponding to "normal" (bytecode) instructions
 * @param options
 */
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) {
      addNode(new NormalStatement(node,i));
      visited.add(s);
    }
    if (s instanceof SSAAbstractInvokeInstruction) {
      addParamPassingStatements((SSAAbstractInvokeInstruction)s,ref);
    }
  }
  return visited;
}

Fixed version (ground truth):
/** 
 * Create nodes in the graph corresponding to "normal" (bytecode) instructions
 * @param options
 */
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) {
      addNode(new NormalStatement(node,i));
      visited.add(s);
    }
    if (s instanceof SSAAbstractInvokeInstruction) {
      addParamPassingStatements(i,ref);
    }
  }
  return visited;
}
Program: 40820
Project: 40820
Buggy source:
public SourceBuffer(Position p) throws IOException {
  this.p=p;
  this.lines=new String[p.getLastLine() - p.getFirstLine() + 1];
  BufferedReader r=new BufferedReader(new InputStreamReader(p.getInputStream()));
  int line=1;
  while (line <= p.getLastLine()) {
    String theLine=r.readLine();
    if (line >= p.getFirstLine()) {
      lines[line - p.getFirstLine()]=line == p.getLastLine() ? theLine.substring(0,p.getLastCol() + 1) : theLine;
    }
    line++;
  }
}

Fixed version (ground truth):
public SourceBuffer(Position p) throws IOException {
  this.p=p;
  this.lines=new String[p.getLastLine() - p.getFirstLine() + 1];
  BufferedReader r=new BufferedReader(new InputStreamReader(p.getInputStream()));
  int line=1;
  while (line <= p.getLastLine()) {
    String theLine=r.readLine();
    if (line >= p.getFirstLine()) {
      lines[line - p.getFirstLine()]=line == p.getLastLine() ? theLine.substring(0,Math.min(theLine.length(),p.getLastCol() + 1)) : theLine;
    }
    line++;
  }
}
Program: 40821
Project: 40821
Buggy source:
/** 
 * @return TypeReference
 */
public FieldReference getDeclaredField(){
  return field;
}

Fixed version (ground truth):
public FieldReference getDeclaredField(){
  return field;
}
Program: 40822
Project: 40822
Buggy source:
@Override public boolean isPEI(){
  return true;
}

Fixed version (ground truth):
@Override public boolean isPEI(){
  return !isStatic();
}
Program: 40823
Project: 40823
Buggy source:
/** 
 * @return TypeReference
 */
public TypeReference getDeclaredFieldType(){
  return field.getFieldType();
}

Fixed version (ground truth):
public TypeReference getDeclaredFieldType(){
  return field.getFieldType();
}
Program: 40824
Project: 40824
Buggy source:
@Override public Collection<TypeReference> getExceptionTypes(){
  return null;
}

Fixed version (ground truth):
@Override public Collection<TypeReference> getExceptionTypes(){
  return Collections.emptySet();
}
Program: 40825
Project: 40825
Buggy source:
public IField getField(Atom name){
  if (fieldMap.containsKey(name)) {
    return fieldMap.get(name);
  }
 else {
    IField f=findDeclaredField(name);
    if (f != null) {
      fieldMap.put(name,f);
      return f;
    }
 else     if (superClass != null) {
      f=superClass.getField(name);
      if (f != null) {
        fieldMap.put(name,f);
        return f;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
public IField getField(Atom name){
  if (fieldMap.containsKey(name)) {
    return fieldMap.get(name);
  }
 else {
    IField f=findDeclaredField(name);
    if (f != null) {
      fieldMap.put(name,f);
      return f;
    }
 else     if (superClass != null) {
      f=superClass.getField(name);
      if (f != null) {
        fieldMap.put(name,f);
        return f;
      }
    }
    try {
      Collection<IClass> ifaces=isInterface() ? getAllAncestorInterfaces() : getAllImplementedInterfaces();
      for (      IClass i : ifaces) {
        f=i.getField(name);
        if (f != null) {
          fieldMap.put(name,f);
          return f;
        }
      }
    }
 catch (    ClassHierarchyException e) {
    }
  }
  return null;
}
Program: 40827
Project: 40827
Buggy source:
@Override public void acceptSearchMatch(SearchMatch match) throws CoreException {
  kludge.add((IJavaElement)match.getElement());
}

Fixed version (ground truth):
@Override public void acceptSearchMatch(SearchMatch match) throws CoreException {
  result.add((IMethod)match.getElement());
}
Program: 40828
Project: 40828
Buggy source:
/** 
 * Find the IType in the workspace corresponding to a class name. TODO: this is too slow. find a better way.
 * @return null if not found
 */
public static IType findJavaClassInWorkspace(String className){
  SearchPattern p=SearchPattern.createPattern(className,IJavaSearchConstants.CLASS,IJavaSearchConstants.DECLARATIONS,SearchPattern.R_EXACT_MATCH);
  IJavaSearchScope scope=SearchEngine.createWorkspaceScope();
  SearchEngine engine=new SearchEngine();
  final Collection<IJavaElement> kludge=HashSetFactory.make();
  SearchRequestor requestor=new SearchRequestor(){
    @Override public void acceptSearchMatch(    SearchMatch match) throws CoreException {
      kludge.add((IJavaElement)match.getElement());
    }
  }
;
  try {
    engine.search(p,new SearchParticipant[]{SearchEngine.getDefaultSearchParticipant()},scope,requestor,null);
  }
 catch (  CoreException e) {
    e.printStackTrace();
  }
  if (kludge.size() == 1) {
    System.err.println("String_Node_Str" + className);
    return (IType)kludge.iterator().next();
  }
 else {
    System.err.println("String_Node_Str" + className);
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Find the IType in the workspace corresponding to a class name. TODO: this is too slow. find a better way.
 * @return null if not found
 */
public static IType findJavaClassInWorkspace(String className){
  SearchPattern p=SearchPattern.createPattern(className,IJavaSearchConstants.CLASS_AND_INTERFACE,IJavaSearchConstants.DECLARATIONS,SearchPattern.R_EXACT_MATCH);
  IJavaSearchScope scope=SearchEngine.createWorkspaceScope();
  SearchEngine engine=new SearchEngine();
  final Collection<IJavaElement> kludge=HashSetFactory.make();
  SearchRequestor requestor=new SearchRequestor(){
    @Override public void acceptSearchMatch(    SearchMatch match) throws CoreException {
      kludge.add((IJavaElement)match.getElement());
    }
  }
;
  try {
    engine.search(p,new SearchParticipant[]{SearchEngine.getDefaultSearchParticipant()},scope,requestor,null);
  }
 catch (  CoreException e) {
    e.printStackTrace();
  }
  if (kludge.size() == 1) {
    System.err.println("String_Node_Str" + className);
    return (IType)kludge.iterator().next();
  }
 else {
    System.err.println("String_Node_Str" + className);
    return null;
  }
}
Program: 40829
Project: 40829
Buggy source:
/** 
 * @param fileName
 * @return the jar file packaged with this plug-in of the given name, or nullif not found.
 */
private static JarFileModule getFromPlugin(String fileName) throws IOException {
  URL url=getFileURLFromPlugin(fileName);
  return (url == null) ? null : new JarFileModule(new JarFile(filePathFromURL(url)));
}

Fixed version (ground truth):
/** 
 * @param fileName
 * @return the jar file packaged with this plug-in of the given name, or nullif not found.
 */
private static JarFileModule getFromPlugin(Plugin p,String fileName) throws IOException {
  URL url=getFileURLFromPlugin(p,fileName);
  return (url == null) ? null : new JarFileModule(new JarFile(filePathFromURL(url)));
}
Program: 40830
Project: 40830
Buggy source:
/** 
 * get a file URL for a file from a plugin
 * @param fileName the file name
 * @return the URL, or <code>null</code> if the file is not found
 * @throws IOException
 */
private static URL getFileURLFromPlugin(String fileName) throws IOException {
  URL url=FileLocator.find(CorePlugin.getDefault().getBundle(),new Path(fileName),null);
  if (url == null) {
    fileName="String_Node_Str" + fileName;
    url=FileLocator.find(CorePlugin.getDefault().getBundle(),new Path(fileName),null);
    if (url == null) {
      return null;
    }
  }
  url=FileLocator.toFileURL(url);
  url=fixupFileURLSpaces(url);
  return url;
}

Fixed version (ground truth):
/** 
 * get a file URL for a file from a plugin
 * @param fileName the file name
 * @return the URL, or <code>null</code> if the file is not found
 * @throws IOException
 */
private static URL getFileURLFromPlugin(Plugin p,String fileName) throws IOException {
  URL url=FileLocator.find(p.getBundle(),new Path(fileName),null);
  if (url == null) {
    fileName="String_Node_Str" + fileName;
    url=FileLocator.find(p.getBundle(),new Path(fileName),null);
    if (url == null) {
      return null;
    }
  }
  url=FileLocator.toFileURL(url);
  url=fixupFileURLSpaces(url);
  return url;
}
Program: 40831
Project: 40831
Buggy source:
/** 
 * @param fileName
 * @return the jar file packaged with this plug-in of the given name, or nullif not found.
 */
private static File getFileFromPlugin(String fileName) throws IOException {
  URL url=getFileURLFromPlugin(fileName);
  if (url == null) {
    throw new FileNotFoundException(fileName);
  }
  return new File(filePathFromURL(url));
}

Fixed version (ground truth):
/** 
 * @param fileName
 * @return the jar file packaged with this plug-in of the given name, or nullif not found.
 */
public static File getFileFromPlugin(Plugin p,String fileName) throws IOException {
  URL url=getFileURLFromPlugin(p,fileName);
  if (url == null) {
    throw new FileNotFoundException(fileName);
  }
  return new File(filePathFromURL(url));
}
Program: 40832
Project: 40832
Buggy source:
/** 
 */
public static File getFile(String fileName) throws IOException {
  return (CorePlugin.getDefault() == null) ? getFileFromClassLoader(fileName) : getFileFromPlugin(fileName);
}

Fixed version (ground truth):
/** 
 */
public static File getFile(String fileName) throws IOException {
  return (CorePlugin.getDefault() == null) ? getFileFromClassLoader(fileName) : getFileFromPlugin(CorePlugin.getDefault(),fileName);
}
Program: 40833
Project: 40833
Buggy source:
/** 
 * @param fileName
 * @return the jar file packaged with this plug-in of the given name, or nullif not found.
 */
public static Module getJarFileModule(String fileName) throws IOException {
  if (CorePlugin.getDefault() == null) {
    return getJarFileFromClassLoader(fileName);
  }
 else {
    try {
      IWorkspaceRoot workspaceRoot=ResourcesPlugin.getWorkspace().getRoot();
      IFile file=workspaceRoot.getFile(new Path(fileName));
      if (file != null) {
        return new JarFileModule(new JarFile(fileName,false));
      }
    }
 catch (    Exception e) {
    }
    return getFromPlugin(fileName);
  }
}

Fixed version (ground truth):
/** 
 * @param fileName
 * @return the jar file packaged with this plug-in of the given name, or nullif not found.
 */
public static Module getJarFileModule(String fileName) throws IOException {
  if (CorePlugin.getDefault() == null) {
    return getJarFileFromClassLoader(fileName);
  }
 else {
    try {
      IWorkspaceRoot workspaceRoot=ResourcesPlugin.getWorkspace().getRoot();
      IFile file=workspaceRoot.getFile(new Path(fileName));
      if (file != null) {
        return new JarFileModule(new JarFile(fileName,false));
      }
    }
 catch (    Exception e) {
    }
    return getFromPlugin(CorePlugin.getDefault(),fileName);
  }
}
Program: 40834
Project: 40834
Buggy source:
public Instruction redirectTargets(int[] targetMap){
  return make(targetMap[label[0]]);
}

Fixed version (ground truth):
public Instruction redirectTargets(int[] targetMap) throws IllegalArgumentException {
  try {
    return make(targetMap[label[0]]);
  }
 catch (  ArrayIndexOutOfBoundsException e) {
    throw new IllegalArgumentException("String_Node_Str",e);
  }
}
Program: 40835
Project: 40835
Buggy source:
public Instruction redirectTargets(int[] targetMap){
  int[] cs=new int[casesAndLabels.length];
  for (int i=0; i < cs.length; i+=2) {
    cs[i]=casesAndLabels[i];
    cs[i + 1]=targetMap[casesAndLabels[i + 1]];
  }
  return make(cs,targetMap[defaultLabel]);
}

Fixed version (ground truth):
public Instruction redirectTargets(int[] targetMap) throws IllegalArgumentException {
  try {
    int[] cs=new int[casesAndLabels.length];
    for (int i=0; i < cs.length; i+=2) {
      cs[i]=casesAndLabels[i];
      cs[i + 1]=targetMap[casesAndLabels[i + 1]];
    }
    return make(cs,targetMap[defaultLabel]);
  }
 catch (  ArrayIndexOutOfBoundsException e) {
    throw new IllegalArgumentException("String_Node_Str",e);
  }
}
Program: 40836
Project: 40836
Buggy source:
public String getJavaLibraryVersion(){
  JarFile rtJar=getRtJar();
  Assertions._assert(rtJar != null,"String_Node_Str");
  try {
    Manifest man=rtJar.getManifest();
    Assertions._assert(man != null,"String_Node_Str");
    String result=man.getMainAttributes().getValue("String_Node_Str");
    if (result == null) {
      Attributes att=man.getMainAttributes();
      System.err.println("String_Node_Str" + att);
      Assertions.UNREACHABLE("String_Node_Str" + rtJar.getName() + "String_Node_Str");
    }
    return result;
  }
 catch (  java.io.IOException e) {
    Assertions.UNREACHABLE("String_Node_Str");
    return null;
  }
}

Fixed version (ground truth):
public String getJavaLibraryVersion() throws IllegalStateException {
  JarFile rtJar=getRtJar();
  if (rtJar == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  try {
    Manifest man=rtJar.getManifest();
    Assertions._assert(man != null,"String_Node_Str");
    String result=man.getMainAttributes().getValue("String_Node_Str");
    if (result == null) {
      Attributes att=man.getMainAttributes();
      System.err.println("String_Node_Str" + att);
      Assertions.UNREACHABLE("String_Node_Str" + rtJar.getName() + "String_Node_Str");
    }
    return result;
  }
 catch (  java.io.IOException e) {
    Assertions.UNREACHABLE("String_Node_Str");
    return null;
  }
}
Program: 40837
Project: 40837
Buggy source:
public boolean isJava15Libraries(){
  return getJavaLibraryVersion().startsWith("String_Node_Str");
}

Fixed version (ground truth):
public boolean isJava15Libraries() throws IllegalStateException {
  return getJavaLibraryVersion().startsWith("String_Node_Str");
}
Program: 40838
Project: 40838
Buggy source:
/** 
 * @return the ClassLoaderReference specified by <code>name</code>.
 */
public ClassLoaderReference getLoader(Atom name){
  if (Assertions.verifyAssertions) {
    if (name.getVal(0) > 'Z') {
      Assertions._assert(name.getVal(0) <= 'Z',"String_Node_Str" + name + "String_Node_Str");
    }
  }
  return loadersByName.get(name);
}

Fixed version (ground truth):
/** 
 * @return the ClassLoaderReference specified by <code>name</code>.
 */
public ClassLoaderReference getLoader(Atom name) throws IllegalArgumentException {
  if (name.length() == 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (Assertions.verifyAssertions) {
    if (name.getVal(0) > 'Z') {
      Assertions._assert(name.getVal(0) <= 'Z',"String_Node_Str" + name + "String_Node_Str");
    }
  }
  return loadersByName.get(name);
}
Program: 40839
Project: 40839
Buggy source:
public boolean isJava14Libraries(){
  return getJavaLibraryVersion().startsWith("String_Node_Str");
}

Fixed version (ground truth):
public boolean isJava14Libraries() throws IllegalStateException {
  return getJavaLibraryVersion().startsWith("String_Node_Str");
}
Program: 40840
Project: 40840
Buggy source:
/** 
 * build a constraint saying v \in s
 */
public static IFormula makeSetConstraint(Variable v,IntSet s){
  IntIterator it=s.intIterator();
  int first=it.next();
  IFormula result=RelationFormula.makeEquals(v,first);
  while (it.hasNext()) {
    int i=it.next();
    result=BinaryFormula.or(result,RelationFormula.makeEquals(v,i));
  }
  return result;
}

Fixed version (ground truth):
/** 
 * build a constraint saying v \in s
 */
public static IFormula makeSetConstraint(Variable v,IntSet s){
  if (s.isEmpty()) {
    return RelationFormula.makeEquals(IntConstant.make(0),IntConstant.make(1));
  }
  IntIterator it=s.intIterator();
  int first=it.next();
  IFormula result=RelationFormula.makeEquals(v,first);
  while (it.hasNext()) {
    int i=it.next();
    result=BinaryFormula.or(result,RelationFormula.makeEquals(v,i));
  }
  return result;
}
Program: 40841
Project: 40841
Buggy source:
public SSAInstruction copyForSSA(int[] defs,int[] uses){
  return new SSAComparisonInstruction(opcode,defs == null || defs.length == 0 ? result : defs[0],uses == null || uses.length == 0 ? val1 : uses[0],uses == null ? val2 : uses[1]);
}

Fixed version (ground truth):
public SSAInstruction copyForSSA(int[] defs,int[] uses) throws IllegalArgumentException {
  if (uses != null && uses.length != 2) {
    throw new IllegalArgumentException("String_Node_Str" + uses.length);
  }
  return new SSAComparisonInstruction(opcode,defs == null || defs.length == 0 ? result : defs[0],uses == null ? val1 : uses[0],uses == null ? val2 : uses[1]);
}
Program: 40842
Project: 40842
Buggy source:
public SSAPhiInstruction(int result,int[] params){
  super();
  this.result=result;
  this.params=params;
}

Fixed version (ground truth):
public SSAPhiInstruction(int result,int[] params) throws IllegalArgumentException {
  super();
  this.result=result;
  this.params=params;
  if (params.length == 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
}
Program: 40843
Project: 40843
Buggy source:
/** 
 * Note: names for class loader references must be unique.
 * @see java.lang.Object#equals(Object)
 */
public boolean equals(Object obj){
  if (Assertions.verifyAssertions) {
    Assertions._assert(this.getClass().equals(obj.getClass()));
  }
  ClassLoaderReference o=(ClassLoaderReference)obj;
  return name.equals(o.name);
}

Fixed version (ground truth):
/** 
 * Note: names for class loader references must be unique.
 * @see java.lang.Object#equals(Object)
 */
public boolean equals(Object obj){
  if (!getClass().equals(obj.getClass())) {
    return false;
  }
 else {
    ClassLoaderReference o=(ClassLoaderReference)obj;
    return name.equals(o.name);
  }
}
Program: 40844
Project: 40844
Buggy source:
public static TypeSignature make(String s){
  assert(s.length() > 0);
switch (s.charAt(0)) {
case TypeReference.VoidTypeCode:
    Assertions.UNREACHABLE();
  return null;
case TypeReference.BooleanTypeCode:
return BaseType.BOOLEAN;
case TypeReference.ByteTypeCode:
return BaseType.BYTE;
case TypeReference.ShortTypeCode:
return BaseType.SHORT;
case TypeReference.IntTypeCode:
return BaseType.INT;
case TypeReference.LongTypeCode:
return BaseType.LONG;
case TypeReference.FloatTypeCode:
return BaseType.FLOAT;
case TypeReference.DoubleTypeCode:
return BaseType.DOUBLE;
case TypeReference.CharTypeCode:
return BaseType.CHAR;
case 'L':
return ClassTypeSignature.makeClassTypeSig(s);
case 'T':
return TypeVariableSignature.make(s);
case TypeReference.ArrayTypeCode:
return ArrayTypeSignature.make(s);
default :
Assertions.UNREACHABLE(s);
return null;
}
}

Fixed version (ground truth):
public static TypeSignature make(String s) throws IllegalArgumentException {
  assert(s.length() > 0);
switch (s.charAt(0)) {
case TypeReference.VoidTypeCode:
    Assertions.UNREACHABLE();
  return null;
case TypeReference.BooleanTypeCode:
return BaseType.BOOLEAN;
case TypeReference.ByteTypeCode:
return BaseType.BYTE;
case TypeReference.ShortTypeCode:
return BaseType.SHORT;
case TypeReference.IntTypeCode:
return BaseType.INT;
case TypeReference.LongTypeCode:
return BaseType.LONG;
case TypeReference.FloatTypeCode:
return BaseType.FLOAT;
case TypeReference.DoubleTypeCode:
return BaseType.DOUBLE;
case TypeReference.CharTypeCode:
return BaseType.CHAR;
case 'L':
return ClassTypeSignature.makeClassTypeSig(s);
case 'T':
return TypeVariableSignature.make(s);
case TypeReference.ArrayTypeCode:
return ArrayTypeSignature.make(s);
default :
throw new IllegalArgumentException("String_Node_Str" + s);
}
}
Program: 40846
Project: 40846
Buggy source:
/** 
 * Is "this" atom a reserved member name? Note: Sun has reserved all member names starting with '<' for future use. At present, only <init> and <clinit> are used.
 */
public final boolean isReservedMemberName(){
  return val[0] == '<';
}

Fixed version (ground truth):
/** 
 * Is "this" atom a reserved member name? Note: Sun has reserved all member names starting with '<' for future use. At present, only <init> and <clinit> are used.
 */
public final boolean isReservedMemberName(){
  if (length() == 0) {
    return false;
  }
  return val[0] == '<';
}
Program: 40847
Project: 40847
Buggy source:
/** 
 * Parse "this" array descriptor to obtain number of dimensions in corresponding array type. this: descriptor - something like "[Ljava/lang/String;" or "[[I"
 * @return dimensionality - something like "1" or "2"
 */
public final int parseForArrayDimensionality(){
  for (int i=0; ; ++i)   if (val[i] != '[')   return i;
}

Fixed version (ground truth):
/** 
 * Parse "this" array descriptor to obtain number of dimensions in corresponding array type. this: descriptor - something like "[Ljava/lang/String;" or "[[I"
 * @return dimensionality - something like "1" or "2"
 */
public final int parseForArrayDimensionality() throws IllegalArgumentException {
  if (val.length == 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  for (int i=0; ; ++i) {
    if (val[i] != '[') {
      return i;
    }
  }
}
Program: 40848
Project: 40848
Buggy source:
public byte getVal(int i){
  return val[i];
}

Fixed version (ground truth):
/** 
 * @param i
 * @return
 */
public byte getVal(int i) throws IllegalArgumentException {
  try {
    return val[i];
  }
 catch (  ArrayIndexOutOfBoundsException e) {
    throw new IllegalArgumentException("String_Node_Str" + i + "String_Node_Str"+ val.length);
  }
}
Program: 40849
Project: 40849
Buggy source:
/** 
 * Is "this" atom a class descriptor?
 */
public final boolean isClassDescriptor(){
  return val[0] == 'L';
}

Fixed version (ground truth):
/** 
 * Is "this" atom a class descriptor?
 */
public final boolean isClassDescriptor(){
  if (length() == 0) {
    return false;
  }
  return val[0] == 'L';
}
Program: 40850
Project: 40850
Buggy source:
/** 
 * Parse "this" array descriptor to obtain descriptor for array's element type. this: array descriptor - something like "[I"
 * @return array element descriptor - something like "I"
 */
public final Atom parseForArrayElementDescriptor(){
  return findOrCreate(val,1,val.length - 1);
}

Fixed version (ground truth):
/** 
 * Parse "this" array descriptor to obtain descriptor for array's element type. this: array descriptor - something like "[I"
 * @return array element descriptor - something like "I"
 */
public final Atom parseForArrayElementDescriptor() throws IllegalArgumentException {
  if (val.length == 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  return findOrCreate(val,1,val.length - 1);
}
Program: 40851
Project: 40851
Buggy source:
/** 
 * Is "this" atom a method descriptor?
 */
public final boolean isMethodDescriptor(){
  return val[0] == '(';
}

Fixed version (ground truth):
/** 
 * Is "this" atom a method descriptor?
 */
public final boolean isMethodDescriptor() throws IllegalArgumentException {
  if (length() == 0) {
    return false;
  }
  return val[0] == '(';
}
Program: 40852
Project: 40852
Buggy source:
/** 
 * Return the innermost element type reference for an array
 */
public final Atom parseForInnermostArrayElementDescriptor(){
  int i=0;
  while (val[i] == '[') {
    i++;
  }
  return findOrCreate(val,i,val.length - i);
}

Fixed version (ground truth):
/** 
 * Return the innermost element type reference for an array
 */
public final Atom parseForInnermostArrayElementDescriptor() throws IllegalArgumentException {
  if (val.length == 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  int i=0;
  while (val[i] == '[') {
    i++;
  }
  return findOrCreate(val,i,val.length - i);
}
Program: 40853
Project: 40853
Buggy source:
public T next(){
  int i=numbers.next();
  T result=nodeManager.getNode(i);
  if (Assertions.verifyAssertions) {
    if (result == null) {
      Assertions._assert(result != null,"String_Node_Str" + i);
    }
  }
  return result;
}

Fixed version (ground truth):
public T next() throws NoSuchElementException {
  int i=numbers.next();
  T result=nodeManager.getNode(i);
  if (Assertions.verifyAssertions) {
    if (result == null) {
      Assertions._assert(result != null,"String_Node_Str" + i);
    }
  }
  return result;
}