public static @Nullable Class<?> getMethodDeclaringClass(@NotNull Class<?> instanceClass, @NonNls @NotNull String methodName, Class<?> @NotNull ... parameters) {
    try {
      return instanceClass.getMethod(methodName, parameters).getDeclaringClass();
    }
    catch (NoSuchMethodException ignore) {
    }

    while (instanceClass != null) {
      try {
        return instanceClass.getDeclaredMethod(methodName, parameters).getDeclaringClass();
      }
      catch (NoSuchMethodException ignored) {
      }
      instanceClass = instanceClass.getSuperclass();
    }
    return null;
  }
public static @Nullable Class<?> getMethodDeclaringClass(@NotNull Class<?> instanceClass, @NonNls @NotNull String methodName, Class<?> @NotNull ... parameters)