Program: 186801
Project: 186801
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. <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 invokeeRef=invoke.getInvokeeRef();
  MethodInfo invokee=invokeeRef.getMethodInfo();
  if (invokee == null) {
    logger.debug("String_Node_Str" + invokeeRef);
    return methods;
  }
  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,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 is only a lookup in the callgraph, and 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)} which handles all special cases and falls backto the default callgraph. </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 invokeeRef=invoke.getInvokeeRef();
  MethodInfo invokee=invokeeRef.getMethodInfo();
  if (invokee == null) {
    logger.debug("String_Node_Str" + invokeeRef);
    return methods;
  }
  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,true)) {
          methods.add(outEdge.getTarget());
        }
      }
 else {
        if (cs.matches(cgString)) {
          methods.add(outEdge.getTarget());
        }
      }
    }
  }
  return methods;
}