Program: 40826
Project: 40826
Buggy source:
/** 
 * Find the IMethod in the workspace corresponding to a method selector.
 * @return null if not found
 */
public static IMethod findJavaMethodInWorkspace(String klass,String selector){
  IType type=null;
  try {
    type=findJavaClassInWorkspace(klass);
  }
 catch (  Throwable t) {
    return null;
  }
  if (type == null) {
    return null;
  }
  String name=parseForName(selector,type);
  String[] paramTypes=parseForParameterTypes(selector);
  IMethod m=type.getMethod(name,paramTypes);
  IMethod[] methods=type.findMethods(m);
  if (methods != null && methods.length == 1) {
    return methods[0];
  }
 else {
    try {
      List<IMethod> matches=new ArrayList<IMethod>();
      ITypeParameter[] tp=type.getTypeParameters();
      Collection<String> typeParameterNames=HashSetFactory.make(tp.length);
      for (      ITypeParameter p : tp) {
        typeParameterNames.add(p.getElementName());
      }
      METHODS:       for (      IMethod x : type.getMethods()) {
        if (x.getElementName().equals(name)) {
          if (x.getParameterTypes().length == paramTypes.length) {
            for (int i=0; i < x.getParameterTypes().length; i++) {
              String s1=Signature.getTypeErasure(Signature.getSignatureSimpleName(x.getParameterTypes()[i]));
              String s2=Signature.getTypeErasure(Signature.getSignatureSimpleName(paramTypes[i]));
              if (typeParameterNames.contains(s1)) {
              }
 else {
                if (!s1.equals(s2)) {
                  continue METHODS;
                }
              }
            }
            matches.add(x);
          }
        }
      }
      if (matches.size() == 1) {
        return matches.get(0);
      }
 else {
        System.err.println("String_Node_Str" + m);
        return null;
      }
    }
 catch (    JavaModelException e) {
      e.printStackTrace();
      return null;
    }
  }
}

Fixed version (ground truth):
/** 
 * Find the IMethod in the workspace corresponding to a method selector. TODO: this is way too slow.   figure out something better.
 * @return null if not found
 */
public static IMethod findJavaMethodInWorkspace(String klass,String selector){
  IType type=null;
  try {
    type=findJavaClassInWorkspace(klass);
  }
 catch (  Throwable t) {
    return null;
  }
  if (type == null) {
    return null;
  }
  String name=parseForName(selector,type);
  String[] paramTypes=parseForParameterTypes(selector);
  IMethod m=type.getMethod(name,paramTypes);
  IMethod[] methods=type.findMethods(m);
  if (methods != null && methods.length == 1) {
    return methods[0];
  }
 else {
    try {
      List<IMethod> matches=new ArrayList<IMethod>();
      Collection<String> typeParameterNames=getTypeParameterNames(type);
      METHODS:       for (      IMethod x : type.getMethods()) {
        if (x.getElementName().equals(name)) {
          if (x.getParameterTypes().length == paramTypes.length) {
            for (int i=0; i < x.getParameterTypes().length; i++) {
              String s1=Signature.getTypeErasure(Signature.getSignatureSimpleName(x.getParameterTypes()[i]));
              String s2=Signature.getTypeErasure(Signature.getSignatureSimpleName(paramTypes[i]));
              if (typeParameterNames.contains(s1)) {
              }
 else {
                if (!s1.equals(s2)) {
                  continue METHODS;
                }
              }
            }
            matches.add(x);
          }
        }
      }
      if (matches.size() == 1) {
        return matches.get(0);
      }
 else {
        System.err.println("String_Node_Str" + m);
        return null;
      }
    }
 catch (    JavaModelException e) {
      e.printStackTrace();
      return null;
    }
  }
}