Program: 185500
Project: 185500
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>
 * @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 nameAndArgsMatch(ClassNode declaringType,List<ClassNode> argumentTypes){
  if (matchOnName(declaringType)) {
    if (argumentTypes == null || argumentTypes.size() == parameterTypeNames.length) {
      return true;
    }
 else {
      boolean[] foundParameterNumbers=cachedParameterCounts.get(declaringType);
      if (foundParameterNumbers == null) {
        foundParameterNumbers=new boolean[MAX_PARAMS + 1];
        gatherParameters(declaringType,foundParameterNumbers);
        cachedParameterCounts.put(declaringType,foundParameterNumbers);
      }
      return !foundParameterNumbers[Math.min(MAX_PARAMS,argumentTypes.size())];
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * When matching method references and declarations, match on the number of parameterrs and assume that it is slightly more accurate than matching on name alone.  If parameters and arguments are equal length, check the type compatibility of each pair. 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>
 */
private boolean nameAndArgsMatch(ClassNode declaringType,List<ClassNode> argumentTypes){
  if (matchOnName(declaringType)) {
    if (argumentTypes == null) {
      return true;
    }
    if (argumentTypes.size() == parameterTypeNames.length) {
      for (int i=0; i < parameterTypeNames.length; i+=1) {
        if (parameterTypeNames[i] == null)         continue;
        ClassNode source=argumentTypes.get(i), target=ClassHelper.makeWithoutCaching(parameterTypeNames[i]);
        if (Boolean.FALSE.equals(SimpleTypeLookup.isTypeCompatible(source,target))) {
          return false;
        }
      }
      return true;
    }
 else {
      boolean[] foundParameterNumbers=cachedParameterCounts.get(declaringType);
      if (foundParameterNumbers == null) {
        foundParameterNumbers=new boolean[MAX_PARAMS + 1];
        gatherParameters(declaringType,foundParameterNumbers);
        cachedParameterCounts.put(declaringType,foundParameterNumbers);
      }
      return !foundParameterNumbers[Math.min(MAX_PARAMS,argumentTypes.size())];
    }
  }
  return false;
}