nus-yam/ex-repair huggingface dataset:
Program: 186798
Project: 186798
Buggy source:
/** 
 * Build a new InnerClasses Attribute containing entries for all inner classes referenced by the current constantpool, using the current ClassInfos or the old InnerClasses attribute to build the table.
 * @return a new InnerClasses attribute or null if this class does not reference any inner classes.
 */
public InnerClasses buildInnerClassesAttribute(){
  ConstantPoolGen cpg=classGen.getConstantPool();
  List<ClassRef> referencedClasses=new LinkedList<ClassRef>();
  for (  String name : ClassReferenceFinder.findReferencedClasses(classInfo)) {
    referencedClasses.add(classInfo.getAppInfo().getClassRef(name));
  }
  Collection<InnerClass> classes=buildInnerClasses(referencedClasses);
  if (classes.isEmpty()) {
    return null;
  }
  InnerClass[] ics=null;
  ics=classes.toArray(ics);
  int length=ics.length * 8 + 2;
  return new InnerClasses(cpg.addUtf8("String_Node_Str"),length,ics,cpg.getConstantPool());
}

Fixed version (ground truth):
/** 
 * Build a new InnerClasses Attribute containing entries for all inner classes referenced by the current constantpool, using the current ClassInfos or the old InnerClasses attribute to build the table.
 * @return a new InnerClasses attribute or null if this class does not reference any inner classes.
 */
public InnerClasses buildInnerClassesAttribute(){
  ConstantPoolGen cpg=classGen.getConstantPool();
  List<ClassRef> referencedClasses=new LinkedList<ClassRef>();
  for (  String name : ConstantPoolReferenceFinder.findReferencedClasses(classInfo)) {
    referencedClasses.add(classInfo.getAppInfo().getClassRef(name));
  }
  Collection<InnerClass> classes=buildInnerClasses(referencedClasses);
  if (classes.isEmpty()) {
    return null;
  }
  InnerClass[] ics=null;
  ics=classes.toArray(ics);
  int length=ics.length * 8 + 2;
  return new InnerClasses(cpg.addUtf8("String_Node_Str"),length,ics,cpg.getConstantPool());
}
Program: 186799
Project: 186799
Buggy source:
/** 
 * Remove attributes related to debugging (e.g. variable name mappings, stack maps, ..) except the linenumber table.
 */
public void removeDebugAttributes(){
  removeLocalVariables();
  for (  Attribute a : getAttributes()) {
    if (a instanceof StackMapTable || a instanceof StackMap) {
      removeAttribute(a);
    }
  }
}

Fixed version (ground truth):
/** 
 * Remove attributes related to debugging (e.g. variable name mappings, stack maps, ..) except the linenumber table.
 */
public void removeDebugAttributes(){
  removeLocalVariables();
  for (  Attribute a : getAttributes()) {
    if (a instanceof StackMapTable || a instanceof StackMap) {
      removeAttribute(a);
      continue;
    }
    ConstantUtf8 name=(ConstantUtf8)getConstantPoolGen().getConstant(a.getNameIndex());
    if ("String_Node_Str".equals(name.getBytes())) {
      removeAttribute(a);
    }
  }
}
Program: 186800
Project: 186800
Buggy source:
/** 
 * Get the invoke instruction of the basic block (which must be the only instruction in the basic block)
 * @return the invoke instruction, or <code>null</code>, if the basic block doesn'tcontain an invoke instruction or if it is a special invoke.
 * @throws ControlFlowGraph.ControlFlowError if there is more than one invoke instruction in the block.
 * @see ProcessorModel#isSpecialInvoke(MethodInfo,Instruction)
 */
public InvokeInstruction getTheInvokeInstruction(){
  InvokeInstruction theInvInstr=null;
  for (  InstructionHandle ih : this.instructions) {
    if (!(ih.getInstruction() instanceof InvokeInstruction))     continue;
    InvokeInstruction inv=(InvokeInstruction)ih.getInstruction();
    if (this.getAppInfo().getProcessorModel().isSpecialInvoke(methodCode.getMethodInfo(),inv)) {
      continue;
    }
    if (theInvInstr != null) {
      throw new ControlFlowGraph.ControlFlowError("String_Node_Str");
    }
    theInvInstr=inv;
  }
  return theInvInstr;
}

Fixed version (ground truth):
/** 
 * Get the invoke instruction of the basic block (which must be the only instruction in the basic block)
 * @return the invoke instruction, or <code>null</code>, if the basic block doesn'tcontain an invoke instruction or if it is a special invoke.
 * @throws ControlFlowGraph.ControlFlowError if there is more than one invoke instruction in the block.
 * @see ProcessorModel#isSpecialInvoke(MethodInfo,Instruction)
 */
public InstructionHandle getTheInvokeInstruction(){
  InstructionHandle theInvInstr=null;
  for (  InstructionHandle ih : this.instructions) {
    if (!(ih.getInstruction() instanceof InvokeInstruction))     continue;
    InvokeInstruction inv=(InvokeInstruction)ih.getInstruction();
    if (this.getAppInfo().getProcessorModel().isSpecialInvoke(methodCode.getMethodInfo(),inv)) {
      continue;
    }
    if (theInvInstr != null) {
      throw new ControlFlowGraph.ControlFlowError("String_Node_Str");
    }
    theInvInstr=ih;
  }
  return theInvInstr;
}
Program: 186802
Project: 186802
Buggy source:
/** 
 * Add a basic block to this graph. The instruction list of the block must not be empty.
 * @param insertBefore insert the block at this position in the block list.
 * @param bb block to add
 * @return the new block node, either an InvokeNode, SpecialInvokeNode or BasicBlockNode, depending on thecontained instructions.
 */
public BasicBlockNode addBasicBlock(int insertBefore,BasicBlock bb){
  BasicBlockNode n;
  Instruction lastInstr=bb.getLastInstruction().getInstruction();
  InvokeInstruction theInvoke=bb.getTheInvokeInstruction();
  if (theInvoke != null) {
    n=new InvokeNode(bb,theInvoke);
  }
 else   if (appInfo.getProcessorModel().isImplementedInJava(lastInstr)) {
    MethodInfo javaImpl=appInfo.getProcessorModel().getJavaImplementation(appInfo,bb.getMethodInfo(),lastInstr);
    n=new SpecialInvokeNode(bb,javaImpl);
  }
 else {
    n=new BasicBlockNode(bb);
  }
  blocks.add(insertBefore,bb);
  graph.addVertex(n);
  return n;
}

Fixed version (ground truth):
/** 
 * Add a basic block to this graph. The instruction list of the block must not be empty.
 * @param insertBefore insert the block at this position in the block list.
 * @param bb block to add
 * @return the new block node, either an InvokeNode, SpecialInvokeNode or BasicBlockNode, depending on thecontained instructions.
 */
public BasicBlockNode addBasicBlock(int insertBefore,BasicBlock bb){
  BasicBlockNode n;
  Instruction lastInstr=bb.getLastInstruction().getInstruction();
  InstructionHandle theInvoke=bb.getTheInvokeInstruction();
  if (theInvoke != null) {
    n=new InvokeNode(bb,theInvoke);
  }
 else   if (appInfo.getProcessorModel().isImplementedInJava(lastInstr)) {
    MethodInfo javaImpl=appInfo.getProcessorModel().getJavaImplementation(appInfo,bb.getMethodInfo(),lastInstr);
    n=new SpecialInvokeNode(bb,javaImpl);
  }
 else {
    n=new BasicBlockNode(bb);
  }
  blocks.add(insertBefore,bb);
  graph.addVertex(n);
  return n;
}
Program: 186803
Project: 186803
Buggy source:
public InvokeNode(BasicBlock block,InvokeInstruction instr){
  super(block);
  this.instr=instr;
  this.referenced=methodInfo.getReferencedMethod(instr);
  this.name="String_Node_Str" + this.referenced + "String_Node_Str";
  if ((instr instanceof INVOKEINTERFACE) || (instr instanceof INVOKEVIRTUAL)) {
    receiverImpl=null;
  }
 else {
    receiverImpl=referenced.getMethodInfo();
  }
}

Fixed version (ground truth):
public InvokeNode(BasicBlock block,InstructionHandle instr){
  super(block);
  this.instr=(InvokeInstruction)instr.getInstruction();
  InvokeSite invokeSite=methodInfo.getCode().getInvokeSite(instr);
  this.referenced=invokeSite.getInvokeeRef();
  if (invokeSite.isVirtual()) {
    receiverImpl=null;
  }
 else {
    receiverImpl=referenced.getMethodInfo();
  }
  this.name="String_Node_Str" + this.referenced + "String_Node_Str";
}
Program: 186805
Project: 186805
Buggy source:
/** 
 * Build a new default callgraph using the current roots as roots for the callgraph, if the default callgraph has not yet been created.
 * @param rebuild if true, rebuild the graph if it already exists. All manual changes and optimizationsof the graph will be lost.
 * @return the default callgraph
 */
public CallGraph buildCallGraph(boolean rebuild){
  if (callGraph == null || rebuild) {
    CallgraphConfig config=new DefaultCallgraphConfig(getCallstringLength());
    callGraph=CallGraph.buildCallGraph(getMainMethod(),config);
  }
  return callGraph;
}

Fixed version (ground truth):
/** 
 * Build a new default callgraph using the current roots as roots for the callgraph, if the default callgraph has not yet been created.
 * @param rebuild if true, rebuild the graph if it already exists. All manual changes and optimizationsof the graph will be lost.
 * @return the default callgraph
 */
public CallGraph buildCallGraph(boolean rebuild){
  if (rebuild) {
    callGraph=null;
  }
  if (callGraph == null) {
    CallgraphConfig config=new DefaultCallgraphConfig(getCallstringLength());
    callGraph=CallGraph.buildCallGraph(getMainMethod(),config);
  }
  return callGraph;
}
Program: 186806
Project: 186806
Buggy source:
/** 
 * Check if this class inherits the given class member.
 * @param member the member to inherit.
 * @param checkInstanceOf if true, check if the member is defined in a superclass or interface of this class,else assume that this has already been checked.
 * @return true if this class inherits it.
 */
public boolean inherits(ClassMemberInfo member,boolean checkInstanceOf){
  ClassInfo cls=member.getClassInfo();
  if (checkInstanceOf && !isInstanceOf(cls)) {
    return false;
  }
  return canAccess(cls,member.getAccessType());
}

Fixed version (ground truth):
/** 
 * Check if this class inherits the given class member.
 * @param member the member to inherit.
 * @param checkInstanceOf if true, check if the member is defined in a superclass or interface of this class,else assume that this has already been checked.
 * @return true if this class inherits it.
 */
public boolean inherits(ClassMemberInfo member,boolean checkInstanceOf){
  ClassInfo cls=member.getClassInfo();
  if (checkInstanceOf && !isSubclassOf(cls)) {
    return false;
  }
  return canAccess(cls,member.getAccessType());
}
Program: 186807
Project: 186807
Buggy source:
/** 
 * Check if the given class is the same as this class or a subclass of this class. This does not check the implemented interfaces. For interfaces this will always return false, even if the given class implements the given interface.
 * @see #isInstanceOf(ClassInfo)
 * @see #isExtensionOf(ClassInfo)
 * @param classInfo the possible subclass of this class.
 * @return true if the given class is this class or a superclass of this class.
 */
public boolean isSuperclassOf(ClassInfo classInfo){
  ClassInfo cls=classInfo;
  while (cls != null) {
    if (this.equals(cls)) {
      return true;
    }
    cls=cls.getSuperClassInfo();
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Check if the given class is the same as this class or a subclass of this class. This does not check the implemented interfaces. For interfaces this will always return false, even if the given class implements the given interface.
 * @see #isSubclassOf(ClassInfo)
 * @see #isExtensionOf(ClassInfo)
 * @param classInfo the possible subclass of this class.
 * @return true if the given class is this class or a superclass of this class.
 */
public boolean isSuperclassOf(ClassInfo classInfo){
  ClassInfo cls=classInfo;
  while (cls != null) {
    if (this.equals(cls)) {
      return true;
    }
    cls=cls.getSuperClassInfo();
  }
  return false;
}
Program: 186808
Project: 186808
Buggy source:
/** 
 * Check if this class is an extension of the given class, i.e. if this is a class, check if the given class is a superclass, if this is an interface, check if the given class is an interface and if this is an extension of the given interface.
 * @see #isInstanceOf(ClassInfo)
 * @see #isImplementationOf(ClassInfo)
 * @param classInfo the class to check.
 * @return true if the class is an extension of this class.
 */
public boolean isExtensionOf(ClassInfo classInfo){
  if (!isInterface()) {
    return !classInfo.isInterface() && classInfo.isSuperclassOf(this);
  }
  if (!classInfo.isInterface()) {
    return false;
  }
  Set<ClassInfo> interfaces=getAncestors();
  return interfaces.contains(classInfo);
}

Fixed version (ground truth):
/** 
 * Check if this class is an extension of the given class, i.e. if this is a class, check if the given class is a superclass, if this is an interface, check if the given class is an interface and if this is an extension of the given interface.
 * @see #isSubclassOf(ClassInfo)
 * @see #isImplementationOf(ClassInfo)
 * @param classInfo the class to check.
 * @return true if the class is an extension of this class.
 */
public boolean isExtensionOf(ClassInfo classInfo){
  if (!isInterface()) {
    return !classInfo.isInterface() && classInfo.isSuperclassOf(this);
  }
  if (!classInfo.isInterface()) {
    return false;
  }
  Set<ClassInfo> interfaces=getAncestors();
  return interfaces.contains(classInfo);
}
Program: 186809
Project: 186809
Buggy source:
/** 
 * Find the class enclosing this class which is the same as or a superclass or an interface of the given class. If the given class is a subclass of this class, this returns null.
 * @param classInfo the (sub)class containing this class.
 * @param membersOnly if true, only check outer classes of member inner classes.
 * @return the found enclosing class or null if none found.
 */
public ClassInfo getEnclosingSuperClassOf(ClassInfo classInfo,boolean membersOnly){
  if (membersOnly && isLocalInnerClass()) {
    return null;
  }
  ClassInfo outer=enclosingClass;
  while (outer != null) {
    if (outer.isInstanceOf(classInfo)) {
      return outer;
    }
    if (membersOnly && outer.isLocalInnerClass()) {
      return null;
    }
 else {
      outer=outer.getEnclosingClassInfo();
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Find the class enclosing this class which is the same as or a superclass or an interface of the given class. If the given class is a subclass of this class, this returns null.
 * @param classInfo the (sub)class containing this class.
 * @param membersOnly if true, only check outer classes of member inner classes.
 * @return the found enclosing class or null if none found.
 */
public ClassInfo getEnclosingSuperClassOf(ClassInfo classInfo,boolean membersOnly){
  if (membersOnly && isLocalInnerClass()) {
    return null;
  }
  ClassInfo outer=enclosingClass;
  while (outer != null) {
    if (outer.isSubclassOf(classInfo)) {
      return outer;
    }
    if (membersOnly && outer.isLocalInnerClass()) {
      return null;
    }
 else {
      outer=outer.getEnclosingClassInfo();
    }
  }
  return null;
}
Program: 186810
Project: 186810
Buggy source:
/** 
 * Check if a member of another class with the given accessType can be accessed by this class or this class member. Note that only methods are able to access local classes.
 * @param cls the class containing the member to check.
 * @param accessType the accessType of the member to check, as returned by {@link MemberInfo#getAccessType()}.
 * @return true if this class is allowed to access members of the given accessType of the given class.
 */
public boolean canAccess(ClassInfo cls,AccessType accessType){
  if (!canAccess(cls)) {
    return false;
  }
switch (accessType) {
case ACC_PUBLIC:
    return true;
case ACC_PROTECTED:
  if (getClassInfo().isInstanceOf(cls)) {
    return true;
  }
case ACC_PACKAGE:
return getClassInfo().hasSamePackage(cls);
case ACC_PRIVATE:
return this.equals(cls) || cls.getInnerClassesInfo().isNestedClassOf(getClassInfo(),true);
}
return false;
}

Fixed version (ground truth):
/** 
 * Check if a member of another class with the given accessType can be accessed by this class or this class member. Note that only methods are able to access local classes.
 * @param cls the class containing the member to check.
 * @param accessType the accessType of the member to check, as returned by {@link MemberInfo#getAccessType()}.
 * @return true if this class is allowed to access members of the given accessType of the given class.
 */
public boolean canAccess(ClassInfo cls,AccessType accessType){
  if (!canAccess(cls)) {
    return false;
  }
switch (accessType) {
case ACC_PUBLIC:
    return true;
case ACC_PROTECTED:
  if (getClassInfo().isSubclassOf(cls)) {
    return true;
  }
case ACC_PACKAGE:
return getClassInfo().hasSamePackage(cls);
case ACC_PRIVATE:
return this.equals(cls) || cls.getInnerClassesInfo().isNestedClassOf(getClassInfo(),true);
}
return false;
}
Program: 186811
Project: 186811
Buggy source:
/** 
 * Check if this method is the same as or overrides a given method.
 * @param superMethod the superMethod to check.
 * @param checkSignature if true, check if the given method has the same signature and is defined in a subclassof this method's class.
 * @return true if this method overrides the given method and can access the method.
 */
public boolean overrides(MethodInfo superMethod,boolean checkSignature){
  if (this.equals(superMethod)) {
    return true;
  }
  if (isStatic()) {
    return false;
  }
  if (superMethod.isStatic()) {
    logger.warn("String_Node_Str" + getSignature() + "String_Node_Str"+ superMethod.getSignature());
  }
  if (checkSignature) {
    if (!getMemberSignature().equals(superMethod.getMemberSignature())) {
      return false;
    }
    if (!getClassInfo().isInstanceOf(superMethod.getClassInfo())) {
      return false;
    }
  }
  return getClassInfo().canAccess(superMethod);
}

Fixed version (ground truth):
/** 
 * Check if this method is the same as or overrides a given method.
 * @param superMethod the superMethod to check.
 * @param checkSignature if true, check if the given method has the same signature and is defined in a subclassof this method's class.
 * @return true if this method overrides the given method and can access the method.
 */
public boolean overrides(MethodInfo superMethod,boolean checkSignature){
  if (this.equals(superMethod)) {
    return true;
  }
  if (isStatic()) {
    return false;
  }
  if (superMethod.isStatic()) {
    logger.warn("String_Node_Str" + getSignature() + "String_Node_Str"+ superMethod.getSignature());
  }
  if (checkSignature) {
    if (!getMemberSignature().equals(superMethod.getMemberSignature())) {
      return false;
    }
    if (!getClassInfo().isSubclassOf(superMethod.getClassInfo())) {
      return false;
    }
  }
  return getClassInfo().canAccess(superMethod);
}
Program: 186812
Project: 186812
Buggy source:
/** 
 * For a given non-empty callstring, find all implementations which might get called by the last invocation in the callstring, i.e. find all methods which might appear in the next entry of the callstring. 
 * @param cs callstring of the invocation, must contain at least one invokesite.
 * @return a list of all methods which might get invoked by the top invocation of the callstring,with their callstrings.
 */
public Set<ExecutionContext> getImplementations(CallString cs){
  InvokeSite invoke=cs.top();
  Set<ExecutionContext> methods=new HashSet<ExecutionContext>();
  MethodRef invokee=invoke.getInvokeeRef();
  Set<ExecutionContext> invoker=getNodes(invoke.getMethod());
  for (  ExecutionContext invokeNode : invoker) {
    for (    ContextEdge outEdge : callGraph.outgoingEdgesOf(invokeNode)) {
      CallString cgString=outEdge.getTarget().getCallString();
      if (cgString.isEmpty()) {
        if (outEdge.getTarget().getMethodInfo().overrides(invokee.getMethodInfo(),true)) {
          methods.add(outEdge.getTarget());
        }
      }
 else {
        if (cs.matches(cgString)) {
          methods.add(outEdge.getTarget());
        }
      }
    }
  }
  return methods;
}

Fixed version (ground truth):
/** 
 * For a given non-empty callstring, find all implementations which might get called by the last invocation in the callstring, i.e. find all methods which might appear in the next entry of the callstring. <p> This does not check if the invocation is a special invoke, so if callstring length of the callgraph is zero, the results are not correct, instead use   {@link AppInfo#findImplementations(CallString)}. </p>
 * @param cs callstring of the invocation, must contain at least one invokesite.
 * @return a list of all methods which might get invoked by the top invocation of the callstring,with their callstrings.
 */
public Set<ExecutionContext> getImplementations(CallString cs){
  InvokeSite invoke=cs.top();
  Set<ExecutionContext> methods=new HashSet<ExecutionContext>();
  MethodRef invokee=invoke.getInvokeeRef();
  Set<ExecutionContext> invoker=getNodes(invoke.getMethod());
  for (  ExecutionContext invokeNode : invoker) {
    for (    ContextEdge outEdge : callGraph.outgoingEdgesOf(invokeNode)) {
      CallString cgString=outEdge.getTarget().getCallString();
      if (cgString.isEmpty()) {
        if (outEdge.getTarget().getMethodInfo().overrides(invokee.getMethodInfo(),true)) {
          methods.add(outEdge.getTarget());
        }
      }
 else {
        if (cs.matches(cgString)) {
          methods.add(outEdge.getTarget());
        }
      }
    }
  }
  return methods;
}
Program: 186813
Project: 186813
Buggy source:
List<ExecutionContext> getInvokedMethods(ExecutionContext context);

Fixed version (ground truth):
Set<ExecutionContext> getInvokedMethods(ExecutionContext context);
Program: 186814
Project: 186814
Buggy source:
/** 
 * Build the callgraph. <p>NEW: now we also use callstrings to get a more precise call graph model</p>
 */
private void buildGraph(){
  callGraph.addGraphListener(new GraphUpdateListener());
  callGraph.addVertex(rootNode);
  if (parent == null) {
    Stack<ExecutionContext> todo=new Stack<ExecutionContext>();
    todo.push(rootNode);
    while (!todo.empty()) {
      ExecutionContext current=todo.pop();
      List<ExecutionContext> invoked=config.getInvokedMethods(current);
      for (      ExecutionContext cgn : invoked) {
        if (!callGraph.containsVertex(cgn)) {
          callGraph.addVertex(cgn);
          todo.push(cgn);
        }
        callGraph.addEdge(current,cgn);
      }
    }
  }
 else {
    cloneReachableGraph(rootNode);
  }
}

Fixed version (ground truth):
/** 
 * Build the callgraph. <p>NEW: now we also use callstrings to get a more precise call graph model</p>
 */
private void buildGraph(){
  callGraph.addGraphListener(new GraphUpdateListener());
  callGraph.addVertex(rootNode);
  if (parent == null) {
    Stack<ExecutionContext> todo=new Stack<ExecutionContext>();
    todo.push(rootNode);
    while (!todo.empty()) {
      ExecutionContext current=todo.pop();
      Set<ExecutionContext> invoked=config.getInvokedMethods(current);
      for (      ExecutionContext cgn : invoked) {
        if (!callGraph.containsVertex(cgn)) {
          callGraph.addVertex(cgn);
          todo.push(cgn);
        }
        callGraph.addEdge(current,cgn);
      }
    }
  }
 else {
    cloneReachableGraph(rootNode);
  }
}
Program: 186815
Project: 186815
Buggy source:
protected Set<MethodInfo> getInvokedMethods(ExecutionContext context,InvokeSite invokeSite){
  return AppInfo.getSingleton().findImplementations(invokeSite.getInvokeeRef());
}

Fixed version (ground truth):
protected Set<MethodInfo> getInvokedMethods(ExecutionContext context,InvokeSite invokeSite){
  return AppInfo.getSingleton().findImplementations(invokeSite,context.getCallString());
}
Program: 186816
Project: 186816
Buggy source:
/** 
 * @return a method reference to the invokee method.
 */
public MethodRef getInvokeeRef(){
  Instruction instr=instruction.getInstruction();
  AppInfo appInfo=AppInfo.getSingleton();
  if (instr instanceof InvokeInstruction) {
    return appInfo.getReferencedMethod(invoker,(InvokeInstruction)instr);
  }
  if (appInfo.getProcessorModel().isImplementedInJava(instr)) {
    return appInfo.getProcessorModel().getJavaImplementation(appInfo,invoker,instr).getMethodRef();
  }
  throw new JavaClassFormatError("String_Node_Str" + toString());
}

Fixed version (ground truth):
/** 
 * Get the MethodRef to the referenced method. <p>Note that this does not resolve to the super  method or does not find all implementations. Use   {@link AppInfo#findImplementations(InvokeSite)} if you want tofind the possible implementing methods of this call.</p>
 * @see AppInfo#getReferencedMethod(MethodInfo,InvokeInstruction)
 * @return a method reference to the invokee method.
 */
public MethodRef getInvokeeRef(){
  Instruction instr=instruction.getInstruction();
  AppInfo appInfo=AppInfo.getSingleton();
  if (instr instanceof InvokeInstruction) {
    return appInfo.getReferencedMethod(invoker,(InvokeInstruction)instr);
  }
  if (appInfo.getProcessorModel().isImplementedInJava(instr)) {
    return appInfo.getProcessorModel().getJavaImplementation(appInfo,invoker,instr).getMethodRef();
  }
  throw new JavaClassFormatError("String_Node_Str" + toString());
}
Program: 186817
Project: 186817
Buggy source:
private void handleClassLoadFailure(String message,Exception cause){
  if (exitOnMissingClass) {
    logger.error(message,cause);
    System.exit(4);
  }
 else {
    throw new MissingClassError(message,cause);
  }
}

Fixed version (ground truth):
private void handleClassLoadFailure(String message,Exception cause){
  throw new MissingClassError(message,cause);
}
Program: 186820
Project: 186820
Buggy source:
private void initProcessorModel(Model model){
  ProcessorModel pm;
switch (model) {
case JOP:
    pm=new JOPModel(config);
  break;
case jamuth:
pm=new JamuthModel(config);
break;
case allocation:
pm=new AllocationModel(config);
break;
default :
throw new BadConfigurationError("String_Node_Str" + model);
}
appInfo.setProcessorModel(pm);
}

Fixed version (ground truth):
private void initProcessorModel(Model model){
  ProcessorModel pm;
switch (model) {
case JOP:
    pm=new JOPModel(config);
  break;
case jamuth:
pm=new JamuthModel(config);
break;
case allocation:
pm=new AllocationModel(config);
break;
default :
throw new BadConfigurationError("String_Node_Str" + model);
}
appInfo.setProcessorModel(pm);
for (String jvmClass : pm.getJVMClasses()) {
ClassInfo rootInfo=appInfo.loadClass(jvmClass.replaceAll("String_Node_Str","String_Node_Str"));
if (rootInfo == null) {
System.err.println("String_Node_Str" + jvmClass + "String_Node_Str");
System.exit(4);
}
appInfo.addRoot(rootInfo);
}
if (appInfo.doLoadNatives()) {
for (String nativeClass : pm.getNativeClasses()) {
ClassInfo rootInfo=appInfo.loadClass(nativeClass.replaceAll("String_Node_Str","String_Node_Str"));
if (rootInfo == null) {
System.err.println("String_Node_Str" + nativeClass + "String_Node_Str");
System.exit(4);
}
appInfo.addRoot(rootInfo);
}
}
}
Program: 186821
Project: 186821
Buggy source:
/** 
 * Get a set of all superclasses (including this class) and all implemented/extended interfaces.
 * @return a set of all superclasses and all interfaces of this class.
 */
public Set<ClassInfo> getAncestors(){
  Set<ClassInfo> sc=new HashSet<ClassInfo>();
  List<ClassInfo> queue=new LinkedList<ClassInfo>();
  queue.add(this);
  while (!queue.isEmpty()) {
    ClassInfo cls=queue.remove(0);
    sc.add(cls);
    ClassInfo superClass=cls.getSuperClassInfo();
    if (superClass != null && !sc.contains(superClass)) {
      queue.add(cls);
    }
    for (    ClassInfo i : cls.getInterfaces()) {
      if (!sc.contains(i)) {
        queue.add(i);
      }
    }
  }
  return sc;
}

Fixed version (ground truth):
/** 
 * Get a set of all superclasses (including this class) and all implemented/extended interfaces.
 * @return a set of all superclasses and all interfaces of this class.
 */
public Set<ClassInfo> getAncestors(){
  Set<ClassInfo> sc=new HashSet<ClassInfo>();
  List<ClassInfo> queue=new LinkedList<ClassInfo>();
  queue.add(this);
  while (!queue.isEmpty()) {
    ClassInfo cls=queue.remove(0);
    sc.add(cls);
    ClassInfo superClass=cls.getSuperClassInfo();
    if (superClass != null && !sc.contains(superClass)) {
      queue.add(superClass);
    }
    for (    ClassInfo i : cls.getInterfaces()) {
      if (!sc.contains(i)) {
        queue.add(i);
      }
    }
  }
  return sc;
}
Program: 186822
Project: 186822
Buggy source:
public MethodRef getEnclosingMethodRef(){
  for (  Attribute a : classInfo.getAttributes()) {
    if (a instanceof EnclosingMethod) {
      return ((EnclosingMethod)a).getMethodRef();
    }
  }
  return null;
}

Fixed version (ground truth):
public MethodRef getEnclosingMethodRef(){
  EnclosingMethod m=getEnclosingMethod();
  return m == null ? null : m.getMethodRef();
}
Program: 186823
Project: 186823
Buggy source:
/** 
 * Get the name of the immediatly enclosing class of this class, if this is a nested class (member or local), or null if this is not a nested class.
 * @see #getOuterClassName()
 * @return the immediatly enclosing class of this class, or null if this is a top-level class.
 */
public String getEnclosingClassName(){
  if (!aNestedClass) {
    return null;
  }
  if (enclosingClass != null) {
    return enclosingClass.getClassName();
  }
  String name=getOuterClassName();
  if (name == null) {
    MethodRef ref=getEnclosingMethodRef();
    if (ref != null) {
      return ref.getClassName();
    }
 else {
      throw new JavaClassFormatError("String_Node_Str" + getClassName());
    }
  }
 else {
    return name;
  }
}

Fixed version (ground truth):
/** 
 * Get the name of the immediatly enclosing class of this class, if this is a nested class (member or local), or null if this is not a nested class.
 * @see #getOuterClassName()
 * @return the immediatly enclosing class of this class, or null if this is a top-level class.
 */
public String getEnclosingClassName(){
  if (!aNestedClass) {
    return null;
  }
  if (enclosingClass != null) {
    return enclosingClass.getClassName();
  }
  String name=getOuterClassName();
  if (name == null) {
    EnclosingMethod m=getEnclosingMethod();
    if (m != null) {
      return m.getClassName();
    }
 else {
      throw new JavaClassFormatError("String_Node_Str" + getClassName());
    }
  }
 else {
    return name;
  }
}
Program: 186824
Project: 186824
Buggy source:
public MethodRef getMethodRef(){
  return AppInfo.getSingleton().getMethodRef(getSignature());
}

Fixed version (ground truth):
public MethodRef getMethodRef(){
  return methodIndex == 0 ? null : AppInfo.getSingleton().getMethodRef(getSignature());
}
Program: 186825
Project: 186825
Buggy source:
public Signature getSignature(){
  ConstantClass cls=(ConstantClass)constant_pool.getConstant(classIndex);
  ConstantNameAndType nat=(ConstantNameAndType)constant_pool.getConstant(methodIndex);
  return new Signature(cls.getBytes(constant_pool).replace('/','.'),nat.getName(constant_pool),Descriptor.parse(nat.getSignature(constant_pool)));
}

Fixed version (ground truth):
public Signature getSignature(){
  if (methodIndex == 0) {
    return new Signature(getClassName());
  }
  ConstantNameAndType nat=(ConstantNameAndType)constant_pool.getConstant(methodIndex);
  return new Signature(getClassName(),nat.getName(constant_pool),Descriptor.parse(nat.getSignature(constant_pool)));
}
Program: 186826
Project: 186826
Buggy source:
private void visitReferences(Set<String> refs){
  for (  String signature : refs) {
    Signature sig=Signature.parse(signature,false);
    ClassInfo cls=getClassInfo(sig.getClassName());
    if (cls == null) {
      ignoreClass(sig.getClassName());
      continue;
    }
    markUsedMembers(cls,false);
    if (sig.isMethodSignature()) {
      MethodRef ref=appInfo.getMethodRef(sig);
      for (      MethodInfo method : findMethods(ref)) {
        markUsedMembers(method);
      }
    }
 else     if (sig.hasMemberName()) {
      FieldRef ref=appInfo.getFieldRef(sig);
      FieldInfo field=ref.getFieldInfo();
      if (field == null) {
        throw new JavaClassFormatError("String_Node_Str" + signature + "String_Node_Str");
      }
      markUsedMembers(field);
    }
  }
}

Fixed version (ground truth):
private void visitReferences(Set<String> refs){
  for (  String signature : refs) {
    Signature sig=Signature.parse(signature,false);
    ClassInfo cls=getClassInfo(sig);
    if (cls == null) {
      continue;
    }
    markUsedMembers(cls,false);
    if (sig.isMethodSignature()) {
      MethodRef ref=appInfo.getMethodRef(sig);
      for (      MethodInfo method : findMethods(ref)) {
        markUsedMembers(method);
      }
    }
 else     if (sig.hasMemberName()) {
      FieldRef ref=appInfo.getFieldRef(sig);
      FieldInfo field=ref.getFieldInfo();
      if (field == null) {
        throw new JavaClassFormatError("String_Node_Str" + signature + "String_Node_Str");
      }
      markUsedMembers(field);
    }
  }
}
Program: 186827
Project: 186827
Buggy source:
private ClassInfo getClassInfo(String className){
  return appInfo.getClassInfo(className);
}

Fixed version (ground truth):
private ClassInfo getClassInfo(Signature sig){
  String className;
  if (sig.isArraySignature()) {
    ArrayTypeInfo at=ArrayTypeInfo.parse(sig.getClassName());
    if (at.getElementType() instanceof ObjectTypeInfo) {
      className=((ObjectTypeInfo)at.getElementType()).getClassRef().getClassName();
    }
 else {
      return null;
    }
  }
 else {
    className=sig.getClassName();
  }
  ClassInfo classInfo=appInfo.getClassInfo(className);
  if (classInfo == null) {
    ignoreClass(className);
  }
  return classInfo;
}
Program: 186828
Project: 186828
Buggy source:
public static void main(String[] args){
  AppSetup setup=new AppSetup();
  setup.setUsageInfo("String_Node_Str","String_Node_Str");
  setup.setVersionInfo(VERSION);
  DFATool dfaTool=new DFATool();
  WCETTool wcetTool=new WCETTool();
  JCopter jcopter=new JCopter();
  setup.registerTool("String_Node_Str",dfaTool,true,false);
  setup.registerTool("String_Node_Str",wcetTool,true,true);
  setup.registerTool("String_Node_Str",jcopter);
  setup.initAndLoad(args,true,true,true);
  if (setup.useTool("String_Node_Str")) {
    wcetTool.setDfaTool(dfaTool);
    jcopter.setDfaTool(dfaTool);
  }
  if (setup.useTool("String_Node_Str")) {
    jcopter.setWcetTool(wcetTool);
  }
  String[] rest=setup.setupConfig(args);
  setup.setupLogger(true);
  setup.setupAppInfo(rest,true);
  jcopter.prepare();
  jcopter.optimize();
  setup.writeClasses();
}

Fixed version (ground truth):
public static void main(String[] args){
  AppSetup setup=new AppSetup();
  setup.setUsageInfo("String_Node_Str","String_Node_Str");
  setup.setVersionInfo(VERSION);
  DFATool dfaTool=new DFATool();
  WCETTool wcetTool=new WCETTool();
  JCopter jcopter=new JCopter();
  setup.registerTool("String_Node_Str",dfaTool,true,false);
  setup.registerTool("String_Node_Str",wcetTool,true,true);
  setup.registerTool("String_Node_Str",jcopter);
  setup.initAndLoad(args,true,true,true);
  if (setup.useTool("String_Node_Str")) {
    wcetTool.setDfaTool(dfaTool);
    jcopter.setDfaTool(dfaTool);
  }
  if (setup.useTool("String_Node_Str")) {
    jcopter.setWcetTool(wcetTool);
  }
  jcopter.prepare();
  jcopter.optimize();
  setup.writeClasses();
}
Program: 186829
Project: 186829
Buggy source:
private void computeOrdering(){
  Set<Transition> cycleTransitions=new TreeSet<Transition>();
  cycleTransitions=markCycles();
  Stack<Location> locStack=new Stack<Location>();
  locStack.push(template.getInitial());
  while (!locStack.empty()) {
    Location loc=locStack.pop();
    Vector<Location> todoPreds=new Stack<Location>();
    int maxPred=-1;
    for (    Transition tPred : loc.getPredecessors()) {
      if (cycleTransitions.contains(tPred))       continue;
      if (orderNumber.containsKey(tPred.getSource())) {
        maxPred=Math.max(maxPred,orderNumber.get(tPred.getSource()));
      }
 else {
        todoPreds.add(tPred.getSource());
      }
    }
    if (todoPreds.isEmpty()) {
      orderNumber.put(loc,maxPred + 1);
      for (      Transition tSucc : loc.getSuccessors()) {
        if (cycleTransitions.contains(tSucc))         continue;
        if (!orderNumber.containsKey(tSucc.getTarget())) {
          locStack.push(tSucc.getTarget());
        }
      }
    }
 else {
      locStack.addAll(todoPreds);
    }
  }
}

Fixed version (ground truth):
private void computeOrdering(){
  Set<Transition> cycleTransitions=new TreeSet<Transition>();
  cycleTransitions=markCycles();
  Stack<Location> locStack=new Stack<Location>();
  locStack.push(template.getInitial());
  while (!locStack.empty()) {
    Location loc=locStack.pop();
    List<Location> todoPreds=new Stack<Location>();
    int maxPred=-1;
    for (    Transition tPred : loc.getPredecessors()) {
      if (cycleTransitions.contains(tPred))       continue;
      if (orderNumber.containsKey(tPred.getSource())) {
        maxPred=Math.max(maxPred,orderNumber.get(tPred.getSource()));
      }
 else {
        todoPreds.add(tPred.getSource());
      }
    }
    if (todoPreds.isEmpty()) {
      orderNumber.put(loc,maxPred + 1);
      for (      Transition tSucc : loc.getSuccessors()) {
        if (cycleTransitions.contains(tSucc))         continue;
        if (!orderNumber.containsKey(tSucc.getTarget())) {
          locStack.push(tSucc.getTarget());
        }
      }
    }
 else {
      locStack.addAll(todoPreds);
    }
  }
}
Program: 186830
Project: 186830
Buggy source:
/** 
 * Remove all classInfos.
 * @param clearRoots if true, clear list of roots and main method as well, elsekeep the root classes in the class list.
 */
public void clear(boolean clearRoots){
  for (  AppEventHandler mgr : eventHandlers) {
    mgr.onClearAppInfo(this);
  }
  classes.clear();
  if (clearRoots) {
    roots.clear();
    mainMethod=null;
  }
 else {
    for (    MemberInfo root : roots) {
      classes.put(root.getClassInfo().getClassName(),root.getClassInfo());
    }
  }
}

Fixed version (ground truth):
/** 
 * Remove all classInfos.
 * @param clearRoots if true, clear list of roots and main method as well, elsekeep the root classes in the class list.
 */
public void clear(boolean clearRoots){
  for (  AppEventHandler mgr : eventHandlers) {
    mgr.onClearAppInfo(this);
  }
  classes.clear();
  if (clearRoots) {
    roots.clear();
    mainMethod=null;
  }
 else {
    for (    MemberInfo root : roots) {
      classes.put(root.getClassInfo().getClassName(),root.getClassInfo());
    }
  }
  callGraph=null;
}
Program: 186832
Project: 186832
Buggy source:
@Override public boolean isVertexMasked(ExecutionContext vertex){
  if (skipIsolated && callGraph.inDegreeOf(vertex) == 0 && callGraph.outDegreeOf(vertex) == 0) {
    return true;
  }
  if (skipNoImp && callGraph.inDegreeOf(vertex) == 0 && callGraph.outDegreeOf(vertex) == 1) {
    ExecutionContext target=callGraph.outgoingEdgesOf(vertex).iterator().next().getTarget();
    if ("String_Node_Str".equals(target.getMethodInfo().getClassName()) && "String_Node_Str".equals(target.getMethodInfo().getShortName())) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean isVertexMasked(MethodContainer vertex){
  if (skipIsolated && graph.inDegreeOf(vertex) == 0 && graph.outDegreeOf(vertex) == 0) {
    return true;
  }
  if (skipNoim && graph.inDegreeOf(vertex) == 0 && graph.outDegreeOf(vertex) == 1) {
    Object edge=graph.outgoingEdgesOf(vertex).iterator().next();
    MethodContainer target=graph.getEdgeTarget(edge);
    if ("String_Node_Str".equals(target.getMethodInfo().getClassName()) && "String_Node_Str".equals(target.getMethodInfo().getShortName())) {
      return true;
    }
  }
  return false;
}
Program: 186833
Project: 186833
Buggy source:
/** 
 * Export the callgraph as a .dot file.
 * @param w Write the graph to this writer. To improve performance, use a buffered writer.
 * @param skipIsolated if true, do not export isolated nodes.
 * @param skipNoImp if true, do not export roots with only one edge to com.jopdesign.sys.JVMHelp.noim().
 * @throws IOException if writing fails.
 */
public void exportDOT(Writer w,final boolean skipIsolated,final boolean skipNoImp) throws IOException {
  AdvancedDOTExporter<ExecutionContext,ContextEdge> exporter=new AdvancedDOTExporter<ExecutionContext,ContextEdge>();
  exporter.setGraphAttribute("String_Node_Str","String_Node_Str");
  DirectedGraph<ExecutionContext,ContextEdge> graph=callGraph;
  if (skipIsolated || skipNoImp) {
    graph=new DirectedMaskSubgraph<ExecutionContext,ContextEdge>(callGraph,new MaskFunctor<ExecutionContext,ContextEdge>(){
      @Override public boolean isEdgeMasked(      ContextEdge edge){
        return false;
      }
      @Override public boolean isVertexMasked(      ExecutionContext vertex){
        if (skipIsolated && callGraph.inDegreeOf(vertex) == 0 && callGraph.outDegreeOf(vertex) == 0) {
          return true;
        }
        if (skipNoImp && callGraph.inDegreeOf(vertex) == 0 && callGraph.outDegreeOf(vertex) == 1) {
          ExecutionContext target=callGraph.outgoingEdgesOf(vertex).iterator().next().getTarget();
          if ("String_Node_Str".equals(target.getMethodInfo().getClassName()) && "String_Node_Str".equals(target.getMethodInfo().getShortName())) {
            return true;
          }
        }
        return false;
      }
    }
);
  }
  exporter.exportDOT(w,graph);
}

Fixed version (ground truth):
/** 
 * Export the callgraph as a .dot file.
 * @param w Write the graph to this writer. To improve performance, use a buffered writer.
 * @param merged if true, export the merged callgraph instead of the full graph.
 * @param skipIsolated if true, do not export isolated nodes.
 * @param skipNoImp if true, do not export roots with only one edge to com.jopdesign.sys.JVMHelp.noim().
 * @throws IOException if writing fails.
 */
public void exportDOT(Writer w,boolean merged,final boolean skipIsolated,final boolean skipNoImp) throws IOException {
  AdvancedDOTExporter<MethodContainer,Object> exporter=new AdvancedDOTExporter<MethodContainer,Object>();
  exporter.setGraphAttribute("String_Node_Str","String_Node_Str");
  if (merged && mergedCallGraph == null) {
    buildMergedGraph();
  }
  @SuppressWarnings({"String_Node_Str"}) DirectedGraph<MethodContainer,Object> graph=(DirectedGraph<MethodContainer,Object>)(merged ? mergedCallGraph : callGraph);
  if (skipIsolated || skipNoImp) {
    graph=new DirectedMaskSubgraph<MethodContainer,Object>(graph,new MethodFilter(graph,skipIsolated,skipNoImp));
  }
  exporter.exportDOT(w,graph);
}
Program: 186834
Project: 186834
Buggy source:
@Override public boolean isEdgeMasked(ContextEdge edge){
  return false;
}

Fixed version (ground truth):
@Override public boolean isEdgeMasked(Object edge){
  return false;
}
Program: 186835
Project: 186835
Buggy source:
/** 
 * Build and initialize everything, perform checks
 */
private void build(){
  logger.info("String_Node_Str" + rootNodes);
  this.buildGraph();
  logger.info("String_Node_Str");
  invalidate();
}

Fixed version (ground truth):
/** 
 * Build and initialize everything, perform checks
 */
private void build(){
  logger.info("String_Node_Str" + MiscUtils.toString(rootNodes,3));
  this.buildGraph();
  logger.info("String_Node_Str");
  invalidate();
}
Program: 186836
Project: 186836
Buggy source:
public String toStringVerbose(){
  if (this.isEmpty())   return "String_Node_Str";
  StringBuffer sb=new StringBuffer("String_Node_Str");
  boolean first=true;
  for (  InvokeSite is : callString) {
    if (first)     first=false;
 else     sb.append("String_Node_Str");
    sb.append(is.toString());
  }
  sb.append("String_Node_Str");
  return sb.toString();
}

Fixed version (ground truth):
public String toStringVerbose(boolean newlines){
  if (this.isEmpty())   return "String_Node_Str";
  StringBuffer sb=new StringBuffer("String_Node_Str");
  boolean first=true;
  for (int i=callString.length - 1; i >= 0; i--) {
    if (first)     first=false;
 else     if (newlines)     sb.append("String_Node_Str");
 else     sb.append("String_Node_Str");
    sb.append(callString[i].toString());
  }
  sb.append("String_Node_Str");
  return sb.toString();
}
Program: 186837
Project: 186837
Buggy source:
public String toString(){
  if (this.isEmpty())   return "String_Node_Str";
  long hash=hashCode();
  if (hash < 0)   hash+=Integer.MAX_VALUE;
  return String.format("String_Node_Str",callString.length,hash);
}

Fixed version (ground truth):
@Override public String toString(){
  if (this.isEmpty())   return "String_Node_Str";
  long hash=hashCode();
  if (hash < 0)   hash+=Integer.MAX_VALUE;
  return String.format("String_Node_Str",callString.length,hash);
}
Program: 186838
Project: 186838
Buggy source:
@Override public String toString(){
  StringBuffer sb=new StringBuffer("String_Node_Str");
  sb.append(method.getFQMethodName());
  if (!callString.isEmpty()) {
    sb.append("String_Node_Str");
    sb.append(callString.toString());
  }
  sb.append("String_Node_Str");
  return sb.toString();
}

Fixed version (ground truth):
@Override public String toString(){
  StringBuffer sb=new StringBuffer("String_Node_Str");
  sb.append(method.getFQMethodName());
  if (!callString.isEmpty()) {
    sb.append("String_Node_Str");
    sb.append(callString.toStringVerbose(true));
  }
  sb.append("String_Node_Str");
  return sb.toString();
}
Program: 186839
Project: 186839
Buggy source:
/** 
 * Escape a string, s.t. it can be used as a DOT attribute value.
 * @param s   input string
 * @param mla alignment type
 * @return the string, with special characters replaced, and quoted if neccessary
 */
public static String escapedToString(String s,MultiLineAlignment mla){
  StringBuffer sb=new StringBuffer();
  boolean quote=false;
  String lineBreak=null;
switch (mla) {
case ML_ALIGN_LEFT:
    lineBreak="String_Node_Str";
  break;
case ML_ALIGN_CENTER:
lineBreak="String_Node_Str";
break;
case ML_ALIGN_RIGHT:
lineBreak="String_Node_Str";
break;
}
for (int i=0; i < s.length(); i++) {
char c=s.charAt(i);
switch (c) {
case '\n':
sb.append(lineBreak);
break;
case '\r':
break;
case '\t':
sb.append("String_Node_Str");
break;
case '"':
sb.append("String_Node_Str");
break;
default :
sb.append(c);
break;
}
if (!Character.isLetterOrDigit(c)) quote=true;
}
if (quote || sb.length() == 0) {
sb.insert(0,'"');
sb.append('"');
}
return sb.toString();
}

Fixed version (ground truth):
/** 
 * Escape a string, s.t. it can be used as a DOT attribute value.
 * @param s   input string
 * @param mla alignment type
 * @return the string, with special characters replaced, and quoted if neccessary
 */
public static String escapedToString(String s,MultiLineAlignment mla){
  StringBuffer sb=new StringBuffer();
  boolean quote=false;
  boolean hasBreak=false;
  String lineBreak=null;
switch (mla) {
case ML_ALIGN_LEFT:
    lineBreak="String_Node_Str";
  break;
case ML_ALIGN_CENTER:
lineBreak="String_Node_Str";
break;
case ML_ALIGN_RIGHT:
lineBreak="String_Node_Str";
break;
}
for (int i=0; i < s.length(); i++) {
char c=s.charAt(i);
switch (c) {
case '\n':
sb.append(lineBreak);
hasBreak=true;
break;
case '\r':
break;
case '\t':
sb.append("String_Node_Str");
break;
case '"':
sb.append("String_Node_Str");
break;
default :
sb.append(c);
break;
}
if (!Character.isLetterOrDigit(c)) quote=true;
}
if (hasBreak) sb.append(lineBreak);
if (quote || sb.length() == 0) {
sb.insert(0,'"');
sb.append('"');
}
return sb.toString();
}
Program: 186840
Project: 186840
Buggy source:
/** 
 * Rebuild the constantpool from a new, empty constantpool. <p>This updates the indices of all references in the code of all methods of this class, therefore do not call this method while modifying the code.</p>
 */
public void rebuildConstantPool(){
  ConstantPoolGen newPool=new ConstantPoolGen();
  ConstantPoolRebuilder rebuilder=new ConstantPoolRebuilder(cpg);
  Set<Integer> usedIndices=ClassReferenceFinder.findPoolReferences(this,true);
  rebuilder.createNewConstantPool(usedIndices);
  rebuilder.updateClassGen(classGen);
  for (  MethodInfo m : methods.values()) {
    rebuilder.updateMethodGen(m,m.getInternalMethodGen());
  }
  for (  FieldInfo f : fields.values()) {
    rebuilder.updateFieldGen(f,f.getInternalFieldGen());
  }
  cpg=newPool;
}

Fixed version (ground truth):
/** 
 * Rebuild the constantpool from a new, empty constantpool. <p>This updates the indices of all references in the code of all methods of this class, therefore do not call this method while modifying the code.</p>
 */
public void rebuildConstantPool(){
  ConstantPoolGen newPool=new ConstantPoolGen();
  ConstantPoolRebuilder rebuilder=new ConstantPoolRebuilder(cpg);
  Set<Integer> usedIndices=ClassReferenceFinder.findPoolReferences(this,true);
  rebuilder.createNewConstantPool(usedIndices);
  rebuilder.updateClassGen(this,classGen);
  for (  MethodInfo m : methods.values()) {
    rebuilder.updateMethodGen(m,m.getInternalMethodGen());
  }
  for (  FieldInfo f : fields.values()) {
    rebuilder.updateFieldGen(f,f.getInternalFieldGen());
  }
  cpg=newPool;
}