private static @Nullable PsiClass getFactoryProducedClass(@Nullable PsiClass psiClass, @Nullable String factoryMethodName) {
    if (psiClass == null || factoryMethodName == null) return null;
    final PsiMethod[] methods = psiClass.findMethodsByName(factoryMethodName, true);
    for (PsiMethod method : methods) {
      if (method.getParameterList().isEmpty() &&
          method.hasModifierProperty(PsiModifier.STATIC)) {
        return PsiUtil.resolveClassInClassTypeOnly(method.getReturnType());
      }
    }
    return null;
  }
private static @Nullable PsiClass getFactoryProducedClass(@Nullable PsiClass psiClass, @Nullable String factoryMethodName)