Program: 185569
Project: 185569
Buggy source:
/** 
 * When matching method references and declarations, we can't actually match on parameter types. Instead, we match on the number of parameterrs and assume that it is slightly more preceise than just matching on name. The heuristic that is used in this method is this: <ol> <li>The search pattern expects 'n' parameters <li>the current node has 'm' arguments. <li>if the m == n, then there is a precise match. <li>if not, look at all methods in current type with same name. <li>if there is a method in the current type with the same number of arguments, then assume the current node matches that other method, and there is no match. <li>If there are no existing methods with same number of parameters, then assume that current method call is an alternative way of calling the method and return a match </ol>
 * @param declaringType
 * @param currentCallCount
 * @return true if there is a precise match between number of arguments and numner of parameters. false if there exists adifferent method with same number of arguments in current type, or true otherwise
 */
private boolean matchOnNumberOfParameters(ClassNode declaringType,int currentCallCount){
  boolean methodParamNumberMatch;
  if (currentCallCount == declaredParameterCount) {
    methodParamNumberMatch=true;
  }
 else {
    boolean[] foundParameterNumbers=cachedParameterCounts.get(declaringType);
    if (foundParameterNumbers == null) {
      foundParameterNumbers=new boolean[MAX_PARAMS + 1];
      gatherParameters(declaringType,foundParameterNumbers);
      cachedParameterCounts.put(declaringType,foundParameterNumbers);
    }
    methodParamNumberMatch=!foundParameterNumbers[Math.min(MAX_PARAMS,currentCallCount)];
  }
  return methodParamNumberMatch;
}

Fixed version (ground truth):
/** 
 * When matching method references and declarations, we can't actually match on parameter types. Instead, we match on the number of parameterrs and assume that it is slightly more preceise than just matching on name. The heuristic that is used in this method is this: <ol> <li>The search pattern expects 'n' parameters <li>the current node has 'm' arguments. <li>if the m == n, then there is a precise match. <li>if not, look at all methods in current type with same name. <li>if there is a method in the current type with the same number of arguments, then assume the current node matches that other method, and there is no match. <li>If there are no existing methods with same number of parameters, then assume that current method call is an alternative way of calling the method and return a match </ol>
 * @return true if there is a precise match between number of arguments andnumner of parameters. false if there exists a different method with same number of arguments in current type, or true otherwise
 */
private boolean matchOnNumberOfParameters(ClassNode declaringType,int currentCallCount){
  boolean methodParamNumberMatch;
  if (currentCallCount == declaredParameterCount) {
    methodParamNumberMatch=true;
  }
 else {
    boolean[] foundParameterNumbers=cachedParameterCounts.get(declaringType);
    if (foundParameterNumbers == null) {
      foundParameterNumbers=new boolean[MAX_PARAMS + 1];
      gatherParameters(declaringType,foundParameterNumbers);
      cachedParameterCounts.put(declaringType,foundParameterNumbers);
    }
    methodParamNumberMatch=!foundParameterNumbers[Math.min(MAX_PARAMS,currentCallCount)];
  }
  return methodParamNumberMatch;
}