nus-yam/ex-repair huggingface dataset:
Program: 40426
Project: 40426
Buggy source:
/** 
 * @see com.ibm.wala.shrikeBT.Instruction.Visitor#visitNew(NewInstruction)
 */
@Override public void visitNew(com.ibm.wala.shrikeBT.NewInstruction instruction){
  int result=reuseOrCreateDef();
  TypeReference t=ShrikeUtil.makeTypeReference(loader,instruction.getType());
  NewSiteReference ref=NewSiteReference.make(getCurrentProgramCounter(),t);
  if (t.isArrayType()) {
    int[] sizes=new int[t.getDimensionality()];
    for (int i=0; i < instruction.getArrayBoundsCount(); i++) {
      sizes[i]=workingState.pop();
    }
    for (int i=instruction.getArrayBoundsCount(); i < sizes.length; i++) {
      sizes[i]=symbolTable.getConstant(0);
    }
    emitInstruction(new SSANewInstruction(result,ref,sizes));
  }
 else {
    emitInstruction(new SSANewInstruction(result,ref));
    popN(instruction);
  }
  workingState.push(result);
}

Fixed version (ground truth):
/** 
 * @see com.ibm.wala.shrikeBT.Instruction.Visitor#visitNew(NewInstruction)
 */
@Override public void visitNew(com.ibm.wala.shrikeBT.NewInstruction instruction){
  int result=reuseOrCreateDef();
  TypeReference t=ShrikeUtil.makeTypeReference(loader,instruction.getType());
  NewSiteReference ref=NewSiteReference.make(getCurrentProgramCounter(),t);
  if (t.isArrayType()) {
    int[] sizes=new int[t.getDimensionality()];
    for (int i=0; i < instruction.getArrayBoundsCount(); i++) {
      sizes[instruction.getArrayBoundsCount() - 1 - i]=workingState.pop();
    }
    for (int i=instruction.getArrayBoundsCount(); i < sizes.length; i++) {
      sizes[i]=symbolTable.getConstant(0);
    }
    emitInstruction(new SSANewInstruction(result,ref,sizes));
  }
 else {
    emitInstruction(new SSANewInstruction(result,ref));
    popN(instruction);
  }
  workingState.push(result);
}
Program: 40427
Project: 40427
Buggy source:
/** 
 * @param pc a program counter (index into ShrikeBT instruction array)
 * @param vn a value number
 * @return if we know that immediately after the given program counter, v_vn corresponds to some set of locals, thenreturn an array of the local numbers. else return null.
 */
private int[] findLocalsForValueNumber(int pc,int vn){
  IBasicBlock bb=shrikeCFG.getBlockForInstruction(pc);
  int firstInstruction=bb.getFirstInstructionIndex();
  int[] locals=block2LocalState[bb.getNumber()];
  if (locals == null) {
    locals=allocateNewLocalsArray();
  }
  for (int i=firstInstruction; i <= pc; i++) {
    if (localStoreMap[i] != null) {
      IntPair p=localStoreMap[i];
      locals[p.getY()]=p.getX();
    }
  }
  return extractIndices(locals,vn);
}

Fixed version (ground truth):
/** 
 * @param pc a program counter (index into ShrikeBT instruction array)
 * @param vn a value number
 * @return if we know that immediately after the given program counter, v_vn corresponds to some set of locals, then return anarray of the local numbers. else return null.
 */
private int[] findLocalsForValueNumber(int pc,int vn){
  IBasicBlock bb=shrikeCFG.getBlockForInstruction(pc);
  int firstInstruction=bb.getFirstInstructionIndex();
  int[] locals=block2LocalState[bb.getNumber()];
  if (locals == null) {
    locals=allocateNewLocalsArray();
  }
  for (int i=firstInstruction; i <= pc; i++) {
    if (localStoreMap[i] != null) {
      IntPair p=localStoreMap[i];
      locals[p.getY()]=p.getX();
    }
  }
  return extractIndices(locals,vn);
}
Program: 40428
Project: 40428
Buggy source:
@Override public String toString(SymbolTable symbolTable){
  return getValueString(symbolTable,result) + "String_Node_Str" + site.getDeclaredType()+ "String_Node_Str"+ site.getProgramCounter()+ (params == null ? "String_Node_Str" : "String_Node_Str" + params.length);
}

Fixed version (ground truth):
@Override public String toString(SymbolTable symbolTable){
  return getValueString(symbolTable,result) + "String_Node_Str" + site.getDeclaredType()+ "String_Node_Str"+ site.getProgramCounter()+ (params == null ? "String_Node_Str" : "String_Node_Str" + params.length + "String_Node_Str"+ array2String(params,symbolTable));
}
Program: 40429
Project: 40429
Buggy source:
public void testMultiNewArray1() throws IOException, ClassHierarchyException {
  AnalysisScope scope=null;
  scope=AnalysisScopeReader.read(TestConstants.WALA_TESTDATA,FileProvider.getFile("String_Node_Str"),MY_CLASSLOADER);
  ClassHierarchy cha=ClassHierarchy.make(scope);
  IClass klass=cha.lookupClass(TypeReference.findOrCreate(ClassLoaderReference.Application,TestConstants.MULTI_DIM_MAIN));
  assertTrue(klass != null);
  IMethod m=klass.getMethod(Selector.make("String_Node_Str"));
  assertTrue(m != null);
  AnalysisCache cache=new AnalysisCache();
  IR ir=cache.getIRFactory().makeIR(m,Everywhere.EVERYWHERE,new SSAOptions());
  assertTrue(ir != null);
  SSAInstruction[] instructions=ir.getInstructions();
  for (  SSAInstruction instr : instructions) {
    if (instr instanceof SSANewInstruction) {
    }
  }
}

Fixed version (ground truth):
public void testMultiNewArray1() throws IOException, ClassHierarchyException {
  AnalysisScope scope=null;
  scope=AnalysisScopeReader.read(TestConstants.WALA_TESTDATA,FileProvider.getFile("String_Node_Str"),MY_CLASSLOADER);
  ClassHierarchy cha=ClassHierarchy.make(scope);
  IClass klass=cha.lookupClass(TypeReference.findOrCreate(ClassLoaderReference.Application,TestConstants.MULTI_DIM_MAIN));
  assertTrue(klass != null);
  IMethod m=klass.getMethod(Selector.make("String_Node_Str"));
  assertTrue(m != null);
  AnalysisCache cache=new AnalysisCache();
  IR ir=cache.getIRFactory().makeIR(m,Everywhere.EVERYWHERE,new SSAOptions());
  assertTrue(ir != null);
  SSAInstruction[] instructions=ir.getInstructions();
  for (  SSAInstruction instr : instructions) {
    if (instr instanceof SSANewInstruction) {
      System.err.println(instr.toString(ir.getSymbolTable()));
      assertTrue(instr.getNumberOfUses() == 3);
      assertTrue(ir.getSymbolTable().getIntValue(instr.getUse(0)) == 3);
      assertTrue(ir.getSymbolTable().getIntValue(instr.getUse(1)) == 4);
    }
  }
}
Program: 40430
Project: 40430
Buggy source:
public InstanceKey getInstanceKeyForAllocation(CGNode node,NewSiteReference allocation){
  IClass type=options.getClassTargetSelector().getAllocatedTarget(node,allocation);
  if (type == null) {
    return null;
  }
  if (node.getContext() instanceof ReceiverInstanceContext) {
    IMethod m=node.getMethod();
    CGNode n=ContainerContextSelector.findNodeRecursiveMatchingContext(m,node.getContext());
    if (n != null) {
      return new NormalAllocationInNode(n,allocation,type);
    }
  }
  InstanceKey key=new NormalAllocationInNode(node,allocation,type);
  return key;
}

Fixed version (ground truth):
public InstanceKey getInstanceKeyForAllocation(CGNode node,NewSiteReference allocation){
  IClass type=options.getClassTargetSelector().getAllocatedTarget(node,allocation);
  if (type == null) {
    return null;
  }
  if (node.getContext() instanceof ReceiverInstanceContext || node.getContext() instanceof CallerContext) {
    IMethod m=node.getMethod();
    CGNode n=ContainerContextSelector.findNodeRecursiveMatchingContext(m,node.getContext());
    if (n != null) {
      return new NormalAllocationInNode(n,allocation,type);
    }
  }
  InstanceKey key=new NormalAllocationInNode(node,allocation,type);
  return key;
}
Program: 40431
Project: 40431
Buggy source:
/** 
 * This method walks recursively up the definition of a context C, to see if the chain of contexts that give rise to C includes the method M. If C is a ReceiverInstanceContext, Let N be the node that allocated C.instance. If N.method == M, return N. Else return findRecursiveMatchingContext(M, N.context) Else return null
 */
public static CGNode findNodeRecursiveMatchingContext(IMethod M,Context C){
  if (DEBUG) {
    System.err.println("String_Node_Str" + M + "String_Node_Str"+ C);
  }
  if (C instanceof ReceiverInstanceContext) {
    ReceiverInstanceContext ric=(ReceiverInstanceContext)C;
    if (!(ric.getReceiver() instanceof AllocationSiteInNode)) {
      return null;
    }
    AllocationSiteInNode I=(AllocationSiteInNode)ric.getReceiver();
    CGNode N=I.getNode();
    if (N.getMethod().equals(M)) {
      return N;
    }
 else {
      return findNodeRecursiveMatchingContext(M,N.getContext());
    }
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
/** 
 * This method walks recursively up the definition of a context C, to see if the chain of contexts that give rise to C includes the method M. If C is a ReceiverInstanceContext, Let N be the node that allocated C.instance. If N.method == M, return N. Else return findRecursiveMatchingContext(M, N.context) Else return null
 */
public static CGNode findNodeRecursiveMatchingContext(IMethod m,Context c){
  if (DEBUG) {
    System.err.println("String_Node_Str" + m + "String_Node_Str"+ c);
  }
  if (c instanceof ReceiverInstanceContext) {
    ReceiverInstanceContext ric=(ReceiverInstanceContext)c;
    if (!(ric.getReceiver() instanceof AllocationSiteInNode)) {
      return null;
    }
    AllocationSiteInNode i=(AllocationSiteInNode)ric.getReceiver();
    CGNode n=i.getNode();
    if (n.getMethod().equals(m)) {
      return n;
    }
 else {
      return findNodeRecursiveMatchingContext(m,n.getContext());
    }
  }
 else   if (c instanceof CallerContext) {
    CallerContext cc=(CallerContext)c;
    CGNode n=cc.getCaller();
    if (n.getMethod().equals(m)) {
      return n;
    }
 else {
      return findNodeRecursiveMatchingContext(m,n.getContext());
    }
  }
 else {
    return null;
  }
}
Program: 40432
Project: 40432
Buggy source:
/** 
 * Return the entry basic block for the CFG.
 * @return the entry basic block for the CFG.
 */
public T entry(){
  return getNode(0);
}

Fixed version (ground truth):
/** 
 * Return the entry basic block for the CFG.
 */
public T entry(){
  return getNode(0);
}
Program: 40433
Project: 40433
Buggy source:
/** 
 * Return the exit basic block for the CFG.
 * @return the exit basic block for the CFG.
 */
public T exit(){
  return exit;
}

Fixed version (ground truth):
/** 
 * Return the exit basic block for the CFG.
 */
public T exit(){
  return exit;
}
Program: 40434
Project: 40434
Buggy source:
/** 
 * @param method
 */
protected AbstractCFG(IMethod method){
  this.method=method;
  this.catchBlocks=new BitVector(10);
}

Fixed version (ground truth):
protected AbstractCFG(IMethod method){
  this.method=method;
  this.catchBlocks=new BitVector(10);
}
Program: 40435
Project: 40435
Buggy source:
public static ExplodedInterproceduralCFG make(CallGraph CG){
  return new ExplodedInterproceduralCFG(CG);
}

Fixed version (ground truth):
public static ExplodedInterproceduralCFG make(CallGraph cg){
  return new ExplodedInterproceduralCFG(cg);
}
Program: 40436
Project: 40436
Buggy source:
public boolean isEntryBlock(){
  return original.isEntryBlock();
}

Fixed version (ground truth):
public boolean isEntryBlock(){
  return instructionIndex == ENTRY_INDEX;
}
Program: 40437
Project: 40437
Buggy source:
public int getPredNodeCount(ExplodedBasicBlock b) throws IllegalArgumentException {
  if (b == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (b.isEntryBlock()) {
    return 0;
  }
  if (b.equals(exit) || b.instructionIndex == b.original.getFirstInstructionIndex()) {
    return ir.getControlFlowGraph().getPredNodeCount(b.original);
  }
 else {
    return 1;
  }
}

Fixed version (ground truth):
public int getPredNodeCount(ExplodedBasicBlock b) throws IllegalArgumentException {
  if (b == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (b.isEntryBlock()) {
    return 0;
  }
  if (b.isExitBlock()) {
    return ir.getControlFlowGraph().getPredNodeCount(ir.getControlFlowGraph().exit());
  }
  if (b.instructionIndex == b.original.getFirstInstructionIndex()) {
    if (b.original.isEntryBlock()) {
      return 1;
    }
 else {
      return ir.getControlFlowGraph().getPredNodeCount(b.original);
    }
  }
 else {
    return 1;
  }
}
Program: 40438
Project: 40438
Buggy source:
public boolean isCatchBlock(){
  return (original.isCatchBlock() && instructionIndex == original.getFirstInstructionIndex());
}

Fixed version (ground truth):
public boolean isCatchBlock(){
  if (original == null) {
    return false;
  }
  return (original.isCatchBlock() && instructionIndex == original.getFirstInstructionIndex());
}
Program: 40439
Project: 40439
Buggy source:
public ExplodedBasicBlock(int instructionIndex,ISSABasicBlock original){
}

Fixed version (ground truth):
public ExplodedBasicBlock(int instructionIndex,ISSABasicBlock original){
  this.instructionIndex=instructionIndex;
  this.original=original;
}
Program: 40440
Project: 40440
Buggy source:
public boolean isExitBlock(){
  return original.isExitBlock();
}

Fixed version (ground truth):
public boolean isExitBlock(){
  return instructionIndex == EXIT_INDEX;
}
Program: 40441
Project: 40441
Buggy source:
private T getDominator(T node){
  return getInfo(node).dominator;
}

Fixed version (ground truth):
private T getDominator(T node){
}
Program: 40442
Project: 40442
Buggy source:
/** 
 * The goal of this step is to perform a DFS numbering on the CFG, starting at the root. The exit node is not included.
 */
private void step1(){
  reachableNodeCount=0;
  DFSDiscoverTimeIterator<T> dfs=new SlowDFSDiscoverTimeIterator<T>(G,root){
    public static final long serialVersionUID=88831771771711L;
    @Override protected void visitEdge(    T from,    T to){
      if (DEBUG)       System.out.println("String_Node_Str" + from + "String_Node_Str"+ to);
      setParent(to,from);
    }
  }
;
  while (dfs.hasNext()) {
    T node=dfs.next();
    vertex[++reachableNodeCount]=node;
    setSemi(node,reachableNodeCount);
    if (DEBUG)     System.out.println(node + "String_Node_Str" + reachableNodeCount);
  }
}

Fixed version (ground truth):
/** 
 * The goal of this step is to perform a DFS numbering on the CFG, starting at the root. The exit node is not included.
 */
private void step1(){
}
Program: 40443
Project: 40443
Buggy source:
@Override protected final DominatorInfo getInfo(T node){
  return (DominatorInfo)infoMap[getGraph().getNumber(node)];
}

Fixed version (ground truth):
@Override protected final DominatorInfo getInfo(T node){
}
Program: 40444
Project: 40444
Buggy source:
public void testSlice2() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
  AnalysisScope scope=CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA,CallGraphTestUtil.REGRESSION_EXCLUSIONS);
  ClassHierarchy cha=ClassHierarchy.make(scope);
  Iterable<Entrypoint> entrypoints=com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope,cha,TestConstants.SLICE2_MAIN);
  AnalysisOptions options=CallGraphTestUtil.makeAnalysisOptions(scope,entrypoints);
  CallGraphBuilder builder=Util.makeZeroOneCFABuilder(options,new AnalysisCache(),cha,scope);
  CallGraph cg=builder.makeCallGraph(options,null);
  CGNode main=findMethod(cg,"String_Node_Str");
  Statement s=findCallTo(main,"String_Node_Str");
  System.err.println("String_Node_Str" + s);
  Collection<Statement> computeBackwardSlice=Slicer.computeBackwardSlice(s,cg,builder.getPointerAnalysis(),DataDependenceOptions.FULL,ControlDependenceOptions.NONE);
  Collection<Statement> slice=computeBackwardSlice;
  dumpSlice(slice);
  assertEquals(22,slice.size());
}

Fixed version (ground truth):
public void testSlice2() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {
  AnalysisScope scope=CallGraphTestUtil.makeJ2SEAnalysisScope(TestConstants.WALA_TESTDATA,CallGraphTestUtil.REGRESSION_EXCLUSIONS);
  ClassHierarchy cha=ClassHierarchy.make(scope);
  Iterable<Entrypoint> entrypoints=com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope,cha,TestConstants.SLICE2_MAIN);
  AnalysisOptions options=CallGraphTestUtil.makeAnalysisOptions(scope,entrypoints);
  CallGraphBuilder builder=Util.makeZeroOneCFABuilder(options,new AnalysisCache(),cha,scope);
  CallGraph cg=builder.makeCallGraph(options,null);
  CGNode main=findMethod(cg,"String_Node_Str");
  Statement s=findCallTo(main,"String_Node_Str");
  System.err.println("String_Node_Str" + s);
  Collection<Statement> computeBackwardSlice=Slicer.computeBackwardSlice(s,cg,builder.getPointerAnalysis(),DataDependenceOptions.FULL,ControlDependenceOptions.NONE);
  Collection<Statement> slice=computeBackwardSlice;
  dumpSlice(slice);
  assertEquals(30,slice.size());
}
Program: 40445
Project: 40445
Buggy source:
@Override public void acceptSearchMatch(SearchMatch match) throws CoreException {
  result.add((IMethod)match.getElement());
}

Fixed version (ground truth):
@Override public void acceptSearchMatch(SearchMatch match) throws CoreException {
  if (match.getElement() instanceof IMethod) {
    result.add((IMethod)match.getElement());
  }
}
Program: 40446
Project: 40446
Buggy source:
/** 
 * @param typeSignature Some of the type signatures examples are "QString;" (String) and "I" (int) The type signatures may be either unresolved (for source types) or resolved (for binary types), and either basic (for basic types) or rich (for parameterized types). See {@link Signature} for details.
 */
public static String getHumanReadableType(String typeSignature){
  String simpleName=Signature.getSignatureSimpleName(typeSignature);
  return simpleName;
}

Fixed version (ground truth):
/** 
 * @param typeSignature Some of the type signatures examples are "QString;" (String) and "I" (int) The type signatures may beeither unresolved (for source types) or resolved (for binary types), and either basic (for basic types) or rich (for parameterized types). See  {@link Signature} for details.
 */
public static String getHumanReadableType(String typeSignature){
  String simpleName=Signature.getSignatureSimpleName(typeSignature);
  return simpleName;
}
Program: 40447
Project: 40447
Buggy source:
/** 
 * Use the search engine to find all methods in a java element
 */
public static Collection<IMethod> findMethods(IJavaElement elt){
  if (elt instanceof ICompilationUnit) {
    Collection<IMethod> result=HashSetFactory.make();
    for (    IType type : getClasses((ICompilationUnit)elt)) {
      try {
        for (        IMethod m : type.getMethods()) {
          result.add(m);
        }
      }
 catch (      JavaModelException e) {
        e.printStackTrace();
      }
    }
    return result;
  }
 else {
    final Collection<IMethod> result=HashSetFactory.make();
    SearchPattern p=SearchPattern.createPattern("String_Node_Str",IJavaSearchConstants.METHOD,IJavaSearchConstants.DECLARATIONS,SearchPattern.R_PATTERN_MATCH);
    IJavaSearchScope scope=SearchEngine.createJavaSearchScope(new IJavaElement[]{elt},IJavaSearchScope.SOURCES);
    SearchEngine engine=new SearchEngine();
    SearchRequestor requestor=new SearchRequestor(){
      @Override public void acceptSearchMatch(      SearchMatch match) throws CoreException {
        result.add((IMethod)match.getElement());
      }
    }
;
    try {
      engine.search(p,new SearchParticipant[]{SearchEngine.getDefaultSearchParticipant()},scope,requestor,null);
    }
 catch (    CoreException e) {
      e.printStackTrace();
    }
    return result;
  }
}

Fixed version (ground truth):
/** 
 * Use the search engine to find all methods in a java element
 */
public static Collection<IMethod> findMethods(IJavaElement elt){
  if (elt instanceof ICompilationUnit) {
    Collection<IMethod> result=HashSetFactory.make();
    for (    IType type : getClasses((ICompilationUnit)elt)) {
      try {
        for (        IMethod m : type.getMethods()) {
          result.add(m);
        }
      }
 catch (      JavaModelException e) {
        e.printStackTrace();
      }
    }
    return result;
  }
 else {
    final Collection<IMethod> result=HashSetFactory.make();
    SearchPattern p=SearchPattern.createPattern("String_Node_Str",IJavaSearchConstants.METHOD,IJavaSearchConstants.DECLARATIONS,SearchPattern.R_PATTERN_MATCH);
    SearchPattern p2=SearchPattern.createPattern("String_Node_Str",IJavaSearchConstants.CONSTRUCTOR,IJavaSearchConstants.DECLARATIONS,SearchPattern.R_PATTERN_MATCH);
    IJavaSearchScope scope=SearchEngine.createJavaSearchScope(new IJavaElement[]{elt},IJavaSearchScope.SOURCES);
    SearchEngine engine=new SearchEngine();
    SearchRequestor requestor=new SearchRequestor(){
      @Override public void acceptSearchMatch(      SearchMatch match) throws CoreException {
        if (match.getElement() instanceof IMethod) {
          result.add((IMethod)match.getElement());
        }
      }
    }
;
    try {
      engine.search(p,new SearchParticipant[]{SearchEngine.getDefaultSearchParticipant()},scope,requestor,null);
      engine.search(p2,new SearchParticipant[]{SearchEngine.getDefaultSearchParticipant()},scope,requestor,null);
    }
 catch (    CoreException e) {
      e.printStackTrace();
    }
    return result;
  }
}
Program: 40448
Project: 40448
Buggy source:
@Override protected void propagate(T s_p,int i,T n,int j){
  super.propagate(s_p,i,n,j);
  if (isExitFromSeedMethod(n)) {
    for (Iterator<? extends T> it2=supergraph.getSuccNodes(n); it2.hasNext(); ) {
      T retSite=it2.next();
      PartiallyBalancedTabulationProblem<T,P> problem=(PartiallyBalancedTabulationProblem<T,P>)getProblem();
      IFlowFunction f=problem.getFunctionMap().getUnbalancedReturnFlowFunction(n,retSite);
      if (f instanceof IUnaryFlowFunction) {
        IUnaryFlowFunction uf=(IUnaryFlowFunction)f;
        IntSet facts=uf.getTargets(j);
        if (facts != null) {
          for (IntIterator it4=facts.intIterator(); it4.hasNext(); ) {
            int d3=it4.next();
            T fakeEntry=problem.getFakeEntry(retSite);
            PathEdge<T> seed=PathEdge.createPathEdge(fakeEntry,d3,retSite,d3);
            addSeed(seed);
          }
        }
      }
 else {
        Assertions.UNREACHABLE("String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
@Override protected void propagate(T s_p,int i,T n,int j){
  super.propagate(s_p,i,n,j);
  if (wasUsedAsUnbalancedSeed(s_p,i) && supergraph.isExit(n)) {
    for (Iterator<? extends T> it2=supergraph.getSuccNodes(n); it2.hasNext(); ) {
      T retSite=it2.next();
      PartiallyBalancedTabulationProblem<T,P> problem=(PartiallyBalancedTabulationProblem<T,P>)getProblem();
      IFlowFunction f=problem.getFunctionMap().getUnbalancedReturnFlowFunction(n,retSite);
      if (f instanceof IUnaryFlowFunction) {
        IUnaryFlowFunction uf=(IUnaryFlowFunction)f;
        IntSet facts=uf.getTargets(j);
        if (facts != null) {
          for (IntIterator it4=facts.intIterator(); it4.hasNext(); ) {
            int d3=it4.next();
            T fakeEntry=problem.getFakeEntry(retSite);
            PathEdge<T> seed=PathEdge.createPathEdge(fakeEntry,d3,retSite,d3);
            addSeed(seed);
          }
        }
      }
 else {
        Assertions.UNREACHABLE("String_Node_Str");
      }
    }
  }
}
Program: 40449
Project: 40449
Buggy source:
@Override public void addSeed(PathEdge<T> seed){
  seedProcedures.add(getSupergraph().getProcOf(seed.entry));
  super.addSeed(seed);
}

Fixed version (ground truth):
@Override public void addSeed(PathEdge<T> seed){
  unbalancedSeeds.add(Pair.make(seed.entry,seed.d1));
  super.addSeed(seed);
}
Program: 40450
Project: 40450
Buggy source:
/** 
 * @param catchClasses Set of TypeReference
 * @param klass an Exception Class
 * @return true iff klass is a subclass of some element of the Set
 * @throws IllegalArgumentException if catchClasses is null
 */
public static boolean catches(Set<IClass> catchClasses,IClass klass,IClassHierarchy cha){
  if (catchClasses == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (catchClasses.size() == 1) {
    IClass c=catchClasses.iterator().next();
    if (c.getReference().equals(TypeReference.JavaLangThread)) {
      return true;
    }
  }
  for (  IClass c : catchClasses) {
    if (cha.isAssignableFrom(c,klass)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * @param catchClasses Set of TypeReference
 * @param klass an Exception Class
 * @return true iff klass is a subclass of some element of the Set
 * @throws IllegalArgumentException if catchClasses is null
 */
public static boolean catches(Set<IClass> catchClasses,IClass klass,IClassHierarchy cha){
  if (catchClasses == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (catchClasses.size() == 1) {
    IClass c=catchClasses.iterator().next();
    if (c != null && c.getReference().equals(TypeReference.JavaLangThread)) {
      return true;
    }
  }
  for (  IClass c : catchClasses) {
    if (c != null && cha.isAssignableFrom(c,klass)) {
      return true;
    }
  }
  return false;
}
Program: 40451
Project: 40451
Buggy source:
/** 
 * Add constraints to represent the flow of exceptions to the exceptional return value for this node
 */
protected void addNodePassthruExceptionConstraints(CGNode node,IR ir){
  List<ProgramCounter> peis=SSAPropagationCallGraphBuilder.getIncomingPEIs(ir,ir.getExitBlock());
  PointerKey exception=heapModel.getPointerKeyForExceptionalReturnValue(node);
  addExceptionDefConstraints(ir,node,peis,exception,PropagationCallGraphBuilder.THROWABLE_SET);
}

Fixed version (ground truth):
/** 
 * Add constraints to represent the flow of exceptions to the exceptional return value for this node
 */
protected void addNodePassthruExceptionConstraints(CGNode node,IR ir){
  List<ProgramCounter> peis=SSAPropagationCallGraphBuilder.getIncomingPEIs(ir,ir.getExitBlock());
  PointerKey exception=heapModel.getPointerKeyForExceptionalReturnValue(node);
  IClass c=node.getClassHierarchy().lookupClass(TypeReference.JavaLangThrowable);
  addExceptionDefConstraints(ir,node,peis,exception,Collections.singleton(c));
}
Program: 40453
Project: 40453
Buggy source:
@Override public void visitGetCaughtException(SSAGetCaughtExceptionInstruction instruction){
  List<ProgramCounter> peis=SSAPropagationCallGraphBuilder.getIncomingPEIs(ir,getBasicBlock());
  PointerKey def=heapModel.getPointerKeyForLocal(node,instruction.getDef());
  Set<TypeReference> types=SSAPropagationCallGraphBuilder.getCaughtExceptionTypes(instruction,ir);
  addExceptionDefConstraints(ir,node,peis,def,types);
}

Fixed version (ground truth):
@Override public void visitGetCaughtException(SSAGetCaughtExceptionInstruction instruction){
  List<ProgramCounter> peis=SSAPropagationCallGraphBuilder.getIncomingPEIs(ir,getBasicBlock());
  PointerKey def=heapModel.getPointerKeyForLocal(node,instruction.getDef());
  Set<IClass> types=SSAPropagationCallGraphBuilder.getCaughtExceptionTypes(instruction,ir);
  addExceptionDefConstraints(ir,node,peis,def,types);
}
Program: 40455
Project: 40455
Buggy source:
protected TabulationCancelException(CancelException cause,Result r){
  super(cause);
  this.result=r;
}

Fixed version (ground truth):
protected TabulationCancelException(Exception cause,Result r){
  super(cause);
  this.result=r;
}
Program: 40456
Project: 40456
Buggy source:
/** 
 * Solve the dataflow problem.
 * @return a representation of the result
 */
public TabulationResult<T,P> solve() throws CancelException {
  try {
    initialize();
    forwardTabulateSLRPs();
    Result r=new Result();
    return r;
  }
 catch (  CancelException e) {
    Result r=new Result();
    throw new TabulationCancelException(e,r);
  }
}

Fixed version (ground truth):
/** 
 * Solve the dataflow problem.
 * @return a representation of the result
 */
public TabulationResult<T,P> solve() throws CancelException {
  try {
    initialize();
    forwardTabulateSLRPs();
    Result r=new Result();
    return r;
  }
 catch (  CancelException e) {
    Result r=new Result();
    throw new TabulationCancelException(e,r);
  }
catch (  CancelRuntimeException e) {
    Result r=new Result();
    throw new TabulationCancelException(e,r);
  }
}
Program: 40458
Project: 40458
Buggy source:
Iterator<PointerKey> getArrayWrites(PointerKey arrayRef){
  arrayRef=convertToHeapModel(arrayRef,mam.getHeapModel());
  Collection<MemoryAccess> arrayWrites=mam.getArrayWrites(arrayRef);
  for (  MemoryAccess a : arrayWrites) {
    addSubgraphForNode(a.getNode());
  }
  ArrayList<PointerKey> written=new ArrayList<PointerKey>();
  for (  MemoryAccess a : arrayWrites) {
    final CGNode node=a.getNode();
    IR ir=node.getIR();
    SSAInstruction instruction=ir.getInstructions()[a.getInstructionIndex()];
    if (instruction == null) {
      continue;
    }
    if (instruction instanceof SSAArrayStoreInstruction) {
      SSAArrayStoreInstruction s=(SSAArrayStoreInstruction)instruction;
      PointerKey r=heapModel.getPointerKeyForLocal(node,s.getValue());
      written.add(r);
    }
 else     if (instruction instanceof SSANewInstruction) {
      SSANewInstruction n=(SSANewInstruction)instruction;
      InstanceKey iKey=heapModel.getInstanceKeyForAllocation(node,n.getNewSite());
      if (iKey == null) {
        continue;
      }
      IClass klass=iKey.getConcreteType();
      if (Assertions.verifyAssertions) {
        Assertions._assert(klass.isArrayClass() && ((ArrayClass)klass).getElementClass().isArrayClass());
      }
      int dim=0;
      InstanceKey lastInstance=iKey;
      while (klass != null && klass.isArrayClass()) {
        klass=((ArrayClass)klass).getElementClass();
        if (klass != null && klass.isArrayClass()) {
          InstanceKey ik=heapModel.getInstanceKeyForMultiNewArray(node,n.getNewSite(),dim);
          PointerKey pk=heapModel.getPointerKeyForArrayContents(lastInstance);
          written.add(pk);
          lastInstance=ik;
          dim++;
        }
      }
    }
 else {
      Assertions.UNREACHABLE();
    }
  }
  return written.iterator();
}

Fixed version (ground truth):
Iterator<PointerKey> getArrayWrites(PointerKey arrayRef){
  arrayRef=convertToHeapModel(arrayRef,mam.getHeapModel());
  Collection<MemoryAccess> arrayWrites=mam.getArrayWrites(arrayRef);
  for (  MemoryAccess a : arrayWrites) {
    addSubgraphForNode(a.getNode());
  }
  ArrayList<PointerKey> written=new ArrayList<PointerKey>();
  for (  MemoryAccess a : arrayWrites) {
    final CGNode node=a.getNode();
    IR ir=node.getIR();
    SSAInstruction instruction=ir.getInstructions()[a.getInstructionIndex()];
    if (instruction == null) {
      continue;
    }
    if (instruction instanceof SSAArrayStoreInstruction) {
      SSAArrayStoreInstruction s=(SSAArrayStoreInstruction)instruction;
      PointerKey r=heapModel.getPointerKeyForLocal(node,s.getValue());
      written.add(r);
    }
 else     if (instruction instanceof SSANewInstruction) {
      NewMultiDimInfo multiDimInfo=DemandPointerFlowGraph.getInfoForNewMultiDim((SSANewInstruction)instruction,heapModel,node);
      for (      Pair<PointerKey,PointerKey> arrStoreInstr : multiDimInfo.arrStoreInstrs) {
        written.add(arrStoreInstr.snd);
      }
    }
 else {
      Assertions.UNREACHABLE();
    }
  }
  return written.iterator();
}
Program: 40459
Project: 40459
Buggy source:
public int[] computeColumnWidths(){
  int[] result=new int[getNumberOfColumns()];
  for (int i=0; i < getNumberOfColumns(); i++) {
    result[i]=columnHeadings.get(i).toString().length() + 1;
  }
  for (int j=0; j < getNumberOfRows(); j++) {
    for (int i=0; i < getNumberOfColumns(); i++) {
      result[i]=Math.max(result[i],getElement(j,i).toString().length() + 1);
    }
  }
  return result;
}

Fixed version (ground truth):
public int[] computeColumnWidths(){
  int[] result=new int[getNumberOfColumns()];
  for (int i=0; i < getNumberOfColumns(); i++) {
    result[i]=columnHeadings.get(i).toString().length() + 1;
  }
  for (int j=0; j < getNumberOfRows(); j++) {
    for (int i=0; i < getNumberOfColumns(); i++) {
      T element=getElement(j,i);
      result[i]=element == null ? result[i] : Math.max(result[i],element.toString().length() + 1);
    }
  }
  return result;
}
Program: 40460
Project: 40460
Buggy source:
@Override public void visitAssignGlobal(AssignGlobalLabel label,Object dst){
  for (Iterator<? extends Object> readIter=g.getReadsOfStaticField((StaticFieldKey)dst); readIter.hasNext(); ) {
    final PointerKey predPk=(PointerKey)readIter.next();
    doTransition(curState,AssignGlobalBarLabel.v(),new Function<State,Object>(){
      public Object apply(      State predPkState){
        PointerKeyAndState predPkAndState=new PointerKeyAndState(predPk,predPkState);
        if (findOrCreate(pkToTrackedSet,predPkAndState).addAll(trackedSet)) {
          addToTrackedPToWorklist(predPkAndState);
        }
        return null;
      }
    }
);
  }
}

Fixed version (ground truth):
@Override public void visitAssignGlobal(AssignGlobalLabel label,Object dst){
  for (Iterator<? extends Object> writesToStaticField=g.getWritesToStaticField((StaticFieldKey)dst); writesToStaticField.hasNext(); ) {
    final PointerKey writtenPk=(PointerKey)writesToStaticField.next();
    doTransition(curState,label,new Function<State,Object>(){
      public Object apply(      State nextState){
        h.propagate(new PointerKeyAndState(writtenPk,nextState));
        return null;
      }
    }
);
  }
}
Program: 40461
Project: 40461
Buggy source:
@Override public void visitNew(NewLabel label,Object dst){
  final InstanceKey ik=(InstanceKey)dst;
  if (DEBUG) {
    System.err.println("String_Node_Str" + ik + "String_Node_Str"+ curPk);
  }
  doTransition(curState,label,new Function<State,Object>(){
    public Object apply(    State newState){
      InstanceKeyAndState ikAndState=new InstanceKeyAndState(ik,newState);
      int n=ikAndStates.add(ikAndState);
      findOrCreate(pkToP2Set,curPkAndState).add(n);
      addToPToWorklist(curPkAndState);
      return null;
    }
  }
);
}

Fixed version (ground truth):
@Override public void visitNew(NewLabel label,Object dst){
  final InstanceKey ik=(InstanceKey)dst;
  if (DEBUG_TOPLEVEL) {
    System.err.println("String_Node_Str" + ik + "String_Node_Str"+ curPk);
  }
  doTransition(curState,label,new Function<State,Object>(){
    public Object apply(    State newState){
      if (!pred.test(ik)) {
        foundBadInstanceKey=true;
      }
      return null;
    }
  }
);
}
Program: 40462
Project: 40462
Buggy source:
private Collection<IMethod> getOTFTargets(CallSiteAndCGNode callSiteAndCGNode,SSAAbstractInvokeInstruction[] callInstrs,State callerState){
  final CallSiteReference call=callSiteAndCGNode.getCallSiteReference();
  final CGNode caller=callSiteAndCGNode.getCGNode();
  Collection<IMethod> result=HashSetFactory.make();
  for (  SSAAbstractInvokeInstruction callInstr : callInstrs) {
    PointerKey thisArg=heapModel.getPointerKeyForLocal(caller,callInstr.getUse(0));
    PointerKeyAndState thisArgAndState=new PointerKeyAndState(thisArg,callerState);
    OrdinalSet<InstanceKeyAndState> thisPToSet=getPToSetFromComputer(ptoComputer,thisArgAndState);
    for (    InstanceKeyAndState ikAndState : thisPToSet) {
      InstanceKey ik=ikAndState.getInstanceKey();
      IMethod targetMethod=options.getMethodTargetSelector().getCalleeTarget(caller,call,ik.getConcreteType());
      if (targetMethod == null) {
        continue;
      }
      result.add(targetMethod);
    }
  }
  return result;
}

Fixed version (ground truth):
private Collection<IMethod> getOTFTargets(CallSiteAndCGNode callSiteAndCGNode,SSAAbstractInvokeInstruction[] callInstrs,State callerState){
  if (DEBUG_TOPLEVEL) {
    System.err.println("String_Node_Str" + callSiteAndCGNode);
  }
  final CallSiteReference call=callSiteAndCGNode.getCallSiteReference();
  final CGNode caller=callSiteAndCGNode.getCGNode();
  Collection<IMethod> result=HashSetFactory.make();
  for (  SSAAbstractInvokeInstruction callInstr : callInstrs) {
    PointerKey thisArg=heapModel.getPointerKeyForLocal(caller,callInstr.getUse(0));
    PointerKeyAndState thisArgAndState=new PointerKeyAndState(thisArg,callerState);
    OrdinalSet<InstanceKeyAndState> thisPToSet=getPToSetFromComputer(ptoComputer,thisArgAndState);
    for (    InstanceKeyAndState ikAndState : thisPToSet) {
      InstanceKey ik=ikAndState.getInstanceKey();
      IMethod targetMethod=options.getMethodTargetSelector().getCalleeTarget(caller,call,ik.getConcreteType());
      if (targetMethod == null) {
        continue;
      }
      result.add(targetMethod);
    }
  }
  return result;
}
Program: 40463
Project: 40463
Buggy source:
/** 
 * track a field of some instance key, as we are interested in statements that read or write to the field
 * @param ikAndState
 * @param field
 * @param ikToFields either {@link #forwInstKeyToFields} or {@link #backInstKeyToFields}
 */
private void trackInstanceField(InstanceKeyAndState ikAndState,IField field,MultiMap<InstanceKeyAndState,IField> ikToFields){
  State state=ikAndState.getState();
  if (Assertions.verifyAssertions) {
  }
  ikToFields.put(ikAndState,field);
  for (Iterator<? extends Object> iter=g.getPredNodes(ikAndState.getInstanceKey(),NewLabel.v()); iter.hasNext(); ) {
    PointerKey ikPred=(PointerKey)iter.next();
    PointerKeyAndState ikPredAndState=new PointerKeyAndState(ikPred,state);
    int mappedIndex=ikAndStates.getMappedIndex(ikAndState);
    if (Assertions.verifyAssertions) {
      Assertions._assert(mappedIndex != -1);
    }
    if (findOrCreate(pkToTrackedSet,ikPredAndState).add(mappedIndex)) {
      addToTrackedPToWorklist(ikPredAndState);
    }
  }
}

Fixed version (ground truth):
/** 
 * track a field of some instance key, as we are interested in statements that read or write to the field
 * @param ikAndState
 * @param field
 * @param ikToFields either {@link #forwInstKeyToFields} or {@link #backInstKeyToFields}
 */
private void trackInstanceField(InstanceKeyAndState ikAndState,IField field,MultiMap<InstanceKeyAndState,IField> ikToFields){
  if (Assertions.verifyAssertions) {
  }
  ikToFields.put(ikAndState,field);
  addPredsOfIKeyAndStateToTrackedPointsTo(ikAndState);
}
Program: 40464
Project: 40464
Buggy source:
@Override public void visitGetField(GetFieldLabel label,Object dst){
  IField field=label.getField();
  PointerKey dstPtrKey=(PointerKey)dst;
  if (refineFieldAccesses(field,curPk,dstPtrKey,label.bar(),curState)) {
    for (    InstanceKeyAndState ikAndState : makeOrdinalSet(trackedSet)) {
      boolean needField=backInstKeyToFields.get(ikAndState).contains(field);
      PointerKeyAndState loadedVal=new PointerKeyAndState(dstPtrKey,curState);
      addEncounteredLoad(new LoadEdge(curPkAndState,field,loadedVal));
      if (needField) {
        InstanceFieldKeyAndState ifk=getInstFieldKey(ikAndState,field);
        if (findOrCreate(pkToTrackedSet,loadedVal).addAll(find(instFieldKeyToTrackedSet,ifk))) {
          addToTrackedPToWorklist(loadedVal);
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void visitGetField(GetFieldLabel label,Object dst){
  IField field=(label).getField();
  PointerKey loadBase=(PointerKey)dst;
  if (refineFieldAccesses(field,loadBase,curPk,label,curState)) {
    if (DEBUG_TOPLEVEL) {
      System.err.println("String_Node_Str" + field);
    }
    OrdinalSet<InstanceKeyAndState> basePToSet=h.getPToSetFromComputer(ptoComputer,new PointerKeyAndState(loadBase,curState));
    if (DEBUG_TOPLEVEL) {
      System.err.println("String_Node_Str" + basePToSet);
    }
    h.computeFlowsTo(ptoComputer,basePToSet);
    if (DEBUG_TOPLEVEL) {
      System.err.println("String_Node_Str");
    }
    for (    MemoryAccess fieldWrite : mam.getFieldWrites(convertToHeapModel(loadBase,mam.getHeapModel()),field)) {
      IR ir=fieldWrite.getNode().getIR();
      SSAPutInstruction s=(SSAPutInstruction)ir.getInstructions()[fieldWrite.getInstructionIndex()];
      if (s == null) {
        continue;
      }
      PointerKey putfieldBase=heapModel.getPointerKeyForLocal(fieldWrite.getNode(),s.getRef());
      PointerKey writtenPk=heapModel.getPointerKeyForLocal(fieldWrite.getNode(),s.getVal());
      Collection<State> reachedFlowStates=h.getFlowedToStates(ptoComputer,basePToSet,putfieldBase);
      for (      State nextState : reachedFlowStates) {
        System.err.println("String_Node_Str" + s);
        h.propagate(new PointerKeyAndState(writtenPk,nextState));
      }
    }
  }
 else {
    for (Iterator<PointerKey> writesToInstanceField=g.getWritesToInstanceField(loadBase,field); writesToInstanceField.hasNext(); ) {
      final PointerKey writtenPk=writesToInstanceField.next();
      doTransition(curState,MatchLabel.v(),new Function<State,Object>(){
        public Object apply(        State nextState){
          h.propagate(new PointerKeyAndState(writtenPk,nextState));
          return null;
        }
      }
);
    }
  }
}
Program: 40465
Project: 40465
Buggy source:
public Object apply(State nextState){
  propagate(new PointerKeyAndState(retVal,nextState));
  return null;
}

Fixed version (ground truth):
public Object apply(State nextState){
  h.propagate(new PointerKeyAndState(succPk,nextState));
  return null;
}
Program: 40466
Project: 40466
Buggy source:
private void computeFlowsTo(PointsToComputer ptoComputer,OrdinalSet<InstanceKeyAndState> basePToSet,IField field){
  for (  InstanceKeyAndState ikAndState : basePToSet) {
    ptoComputer.trackInstanceField(ikAndState,field,ptoComputer.forwInstKeyToFields);
  }
  ptoComputer.worklistLoop();
}

Fixed version (ground truth):
private void computeFlowsTo(PointsToComputer ptoComputer,OrdinalSet<InstanceKeyAndState> basePToSet){
}
Program: 40467
Project: 40467
Buggy source:
@Override public void visitAssign(AssignLabel label,Object dst){
  final PointerKey predPk=(PointerKey)dst;
  doTransition(curState,AssignBarLabel.noFilter(),new Function<State,Object>(){
    public Object apply(    State predPkState){
      PointerKeyAndState predPkAndState=new PointerKeyAndState(predPk,predPkState);
      if (findOrCreate(pkToTrackedSet,predPkAndState).addAll(trackedSet)) {
        addToTrackedPToWorklist(predPkAndState);
      }
      return null;
    }
  }
);
}

Fixed version (ground truth):
@Override public void visitAssign(AssignLabel label,Object dst){
  final PointerKey succPk=(PointerKey)dst;
  doTransition(curState,label,new Function<State,Object>(){
    public Object apply(    State nextState){
      h.propagate(new PointerKeyAndState(succPk,nextState));
      return null;
    }
  }
);
}
Program: 40470
Project: 40470
Buggy source:
private boolean addAllToP2Set(Map<PointerKeyAndState,MutableIntSet> p2setMap,PointerKeyAndState pkAndState,IntSet vals,IFlowLabel label){
  final PointerKey pk=pkAndState.getPointerKey();
  if (pk instanceof FilteredPointerKey) {
    if (DEBUG) {
      System.err.println("String_Node_Str" + pk);
    }
    final TypeFilter typeFilter=((FilteredPointerKey)pk).getTypeFilter();
    vals=updateValsForFilter(vals,typeFilter);
  }
  if (label instanceof IFlowLabelWithFilter) {
    TypeFilter typeFilter=((IFlowLabelWithFilter)label).getFilter();
    if (typeFilter != null) {
      vals=updateValsForFilter(vals,typeFilter);
    }
  }
  boolean added=findOrCreate(p2setMap,pkAndState).addAll(vals);
  if (DEBUG && added) {
  }
  return added;
}

Fixed version (ground truth):
private boolean addAllToP2Set(Map<PointerKeyAndState,MutableIntSet> p2setMap,PointerKeyAndState pkAndState,IntSet vals,IFlowLabel label){
  final PointerKey pk=pkAndState.getPointerKey();
  if (pk instanceof FilteredPointerKey) {
    if (DEBUG) {
      System.err.println("String_Node_Str" + pk);
    }
    final TypeFilter typeFilter=((FilteredPointerKey)pk).getTypeFilter();
    vals=updateValsForFilter(vals,typeFilter);
  }
  if (label instanceof IFlowLabelWithFilter) {
    TypeFilter typeFilter=((IFlowLabelWithFilter)label).getFilter();
    if (typeFilter != null) {
      vals=updateValsForFilter(vals,typeFilter);
    }
  }
  boolean added=findOrCreate(p2setMap,pkAndState).addAll(vals);
  if (DEBUG && added) {
    System.err.println("String_Node_Str" + pkAndState + "String_Node_Str");
    for (    InstanceKeyAndState ikAndState : makeOrdinalSet(vals)) {
      System.err.println(ikAndState);
    }
    System.err.println("String_Node_Str");
  }
  return added;
}
Program: 40471
Project: 40471
Buggy source:
/** 
 * Compute an analysis scope for the current selection
 * @throws IOException 
 * @throws JavaModelException 
 */
public static AnalysisScope computeScope(IStructuredSelection selection) throws JavaModelException, IOException {
  Collection<EclipseProjectPath> projectPaths=HashSetFactory.make();
  for (Iterator it=selection.iterator(); it.hasNext(); ) {
    Object object=it.next();
    if (object instanceof IJavaElement) {
      IJavaElement e=(IJavaElement)object;
      IJavaProject jp=e.getJavaProject();
      projectPaths.add(EclipseProjectPath.make(ResourcesPlugin.getWorkspace().getRoot().getLocation(),jp));
    }
 else {
      Assertions.UNREACHABLE(object.getClass());
    }
  }
  AnalysisScope scope=mergeProjectPaths(projectPaths);
  return scope;
}

Fixed version (ground truth):
/** 
 * Compute an analysis scope for the current selection
 * @throws IOException 
 * @throws JavaModelException 
 */
public static AnalysisScope computeScope(IStructuredSelection selection) throws JavaModelException, IOException {
  Collection<EclipseProjectPath> projectPaths=HashSetFactory.make();
  for (Iterator it=selection.iterator(); it.hasNext(); ) {
    Object object=it.next();
    if (object instanceof IJavaElement) {
      IJavaElement e=(IJavaElement)object;
      IJavaProject jp=e.getJavaProject();
      projectPaths.add(EclipseProjectPath.make(jp));
    }
 else {
      Assertions.UNREACHABLE(object.getClass());
    }
  }
  AnalysisScope scope=mergeProjectPaths(projectPaths);
  return scope;
}
Program: 40472
Project: 40472
Buggy source:
protected EclipseProjectPath(IPath workspaceRootPath,IJavaProject project) throws JavaModelException, IOException {
}

Fixed version (ground truth):
protected EclipseProjectPath(IJavaProject project) throws JavaModelException, IOException {
}
Program: 40473
Project: 40473
Buggy source:
public static EclipseProjectPath make(IPath workspaceRootPath,IJavaProject project) throws JavaModelException, IOException {
  if (workspaceRootPath == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  return new EclipseProjectPath(workspaceRootPath,project);
}

Fixed version (ground truth):
public static EclipseProjectPath make(IJavaProject project) throws JavaModelException, IOException {
  return new EclipseProjectPath(project);
}
Program: 40474
Project: 40474
Buggy source:
protected IPath makeAbsolute(IPath p){
  if (p.toFile().exists()) {
    return p;
  }
  return workspaceRootPath.append(p);
}

Fixed version (ground truth):
protected IPath makeAbsolute(IPath p){
  if (p.toFile().exists()) {
    return p;
  }
  String projectName=p.segment(0);
  IJavaProject jp=JdtUtil.getJavaProject(projectName);
  if (jp != null) {
    if (jp.getProject().getRawLocation() != null) {
      return jp.getProject().getRawLocation().append(p.removeFirstSegments(1));
    }
 else {
      IWorkspaceRoot workspaceRoot=ResourcesPlugin.getWorkspace().getRoot();
      return workspaceRoot.getLocation().append(p);
    }
  }
 else {
    Assertions.UNREACHABLE("String_Node_Str" + p);
    return null;
  }
}
Program: 40475
Project: 40475
Buggy source:
/** 
 * compute the analysis scope for a project in the current workspace
 * @throws IOException 
 * @throws JavaModelException 
 */
public static AnalysisScope computeScope(String projectName) throws JavaModelException, IOException {
  IJavaProject jp=getProjectFromWorkspace(projectName);
  IWorkspaceRoot workspaceRoot=ResourcesPlugin.getWorkspace().getRoot();
  EclipseProjectPath path=EclipseProjectPath.make(workspaceRoot.getLocation(),jp);
  return path.toAnalysisScope(null);
}

Fixed version (ground truth):
/** 
 * compute the analysis scope for a project in the current workspace
 * @throws IOException 
 * @throws JavaModelException 
 */
public static AnalysisScope computeScope(String projectName) throws JavaModelException, IOException {
  IJavaProject jp=getProjectFromWorkspace(projectName);
  EclipseProjectPath path=EclipseProjectPath.make(jp);
  return path.toAnalysisScope(null);
}