@Nullable
    private static PsiMethod findOnlyMethod(@Nullable PsiType inType, @NotNull PsiType outType) {
      if (!(inType instanceof PsiClassType)) return null;
      PsiClassType.ClassResolveResult result = ((PsiClassType)inType).resolveGenerics();
      PsiClass psiClass = result.getElement();
      if (psiClass == null || psiClass instanceof PsiTypeParameter) return null;
      return StreamEx.of(psiClass.getAllMethods())
        .collect(MoreCollectors.onlyOne(method -> {
          if (method.hasModifierProperty(PsiModifier.STATIC) || !method.hasModifierProperty(PsiModifier.PUBLIC)) return false;
          if (method.isConstructor()) return false;
          if (method.getName().equals("hashCode")) return false;
          if (!method.getParameterList().isEmpty()) return false;
          PsiType type = method.getReturnType();
          if (type == null || PsiTypes.voidType().equals(type)) return false;
          if (type instanceof PsiClassType) {
            PsiClass containingClass = method.getContainingClass();
            if (containingClass == null) return false;
            type = TypeConversionUtil.getSuperClassSubstitutor(containingClass, (PsiClassType)inType).substitute(type);
          }
          return outType.isAssignableFrom(type);
        })).orElse(null);
    }
@Nullable
    private static PsiMethod findOnlyMethod(@Nullable PsiType inType, @NotNull PsiType outType)