private static @NotNull List<PsiMethod> findMethodsBySignature(@NotNull PsiClass aClass,
                                                                 @NotNull PsiMethod patternMethod,
                                                                 boolean checkBases,
                                                                 boolean stopOnFirst) {
    PsiMethod[] methodsByName = aClass.findMethodsByName(patternMethod.getName(), checkBases);
    if (methodsByName.length == 0) return Collections.emptyList();
    List<PsiMethod> methods = new SmartList<>();
    MethodSignature patternSignature = patternMethod.getSignature(PsiSubstitutor.EMPTY);
    for (PsiMethod method : methodsByName) {
      PsiClass superClass = method.getContainingClass();
      PsiSubstitutor substitutor = checkBases && !aClass.equals(superClass) && superClass != null ?
                                         TypeConversionUtil.getSuperClassSubstitutor(superClass, aClass, PsiSubstitutor.EMPTY) :
                                         PsiSubstitutor.EMPTY;
      MethodSignature signature = method.getSignature(substitutor);
      if (signature.equals(patternSignature)) {
        methods.add(method);
        if (stopOnFirst) {
          break;
        }
      }
    }
    return methods;
  }
private static @NotNull List<PsiMethod> findMethodsBySignature(@NotNull PsiClass aClass,
                                                                 @NotNull PsiMethod patternMethod,
                                                                 boolean checkBases,
                                                                 boolean stopOnFirst)