public static @NlsContexts.DetailedDescription String checkInterfaceFunctional(@NotNull PsiElement context, @NotNull PsiType functionalInterfaceType) {
    if (functionalInterfaceType instanceof PsiIntersectionType intersection) {
      Set<MethodSignature> signatures = new HashSet<>();
      Map<PsiType, MethodSignature> typeAndSignature = new HashMap<>();
      for (PsiType type : intersection.getConjuncts()) {
        if (checkInterfaceFunctional(context, type) == null) {
          MethodSignature signature = getFunction(PsiUtil.resolveClassInType(type));
          LOG.assertTrue(signature != null, type.getCanonicalText());
          signatures.add(signature);
          typeAndSignature.put(type, signature);
        }
      }
      PsiType baseType = typeAndSignature.entrySet().iterator().next().getKey();
      MethodSignature baseSignature = typeAndSignature.get(baseType);
      LambdaUtil.TargetMethodContainer baseContainer = getTargetMethod(baseType, baseSignature, baseType);
      if (baseContainer == null) {
        return JavaErrorBundle.message("no.target.method.found");
      }
      PsiMethod baseMethod = baseContainer.targetMethod;
      if (signatures.size() > 1) {
        for (Map.Entry<PsiType, MethodSignature> entry : typeAndSignature.entrySet()) {
          if (baseType == entry.getKey()) {
            continue;
          }
          LambdaUtil.TargetMethodContainer container = getTargetMethod(entry.getKey(), baseSignature, baseType);
          if (container == null) {
            return JavaErrorBundle.message("multiple.non.overriding.abstract.methods.found.in.0",
                                           functionalInterfaceType.getPresentableText());
          }
          if (!LambdaUtil.isLambdaSubsignature(baseMethod, baseType, container.targetMethod, entry.getKey()) ||
              !container.inheritor.hasModifier(JvmModifier.ABSTRACT)) {
            return JavaErrorBundle.message("multiple.non.overriding.abstract.methods.found.in.0",
                                           functionalInterfaceType.getPresentableText());
          }
        }
      }
      for (PsiType type : intersection.getConjuncts()) {
        if (typeAndSignature.containsKey(type)) {
          continue;
        }
        LambdaUtil.TargetMethodContainer container = getTargetMethod(type, baseSignature, baseType);
        if (container == null) {
          continue;
        }
        PsiMethod inheritor = container.inheritor;
        PsiMethod target = container.targetMethod;
        if (!inheritor.hasModifier(JvmModifier.ABSTRACT) && LambdaUtil.isLambdaSubsignature(baseMethod, baseType, target, type)) {
          return JavaErrorBundle.message("no.target.method.found");
        }
      }
      return null;
    }
    PsiClassType.ClassResolveResult resolveResult = PsiUtil.resolveGenericsClassInType(functionalInterfaceType);
    PsiClass aClass = resolveResult.getElement();
    if (aClass != null) {
      if (aClass instanceof PsiTypeParameter) return null; //should be logged as cyclic inference
      MethodSignature functionalMethod = getFunction(aClass);
      if (functionalMethod != null && functionalMethod.getTypeParameters().length > 0) {
        return JavaErrorBundle
          .message("target.method.is.generic");
      }
      return checkInterfaceFunctional(aClass);
    }
    if (IncompleteModelUtil.isIncompleteModel(context) &&
        IncompleteModelUtil.isUnresolvedClassType(functionalInterfaceType)) {
      return null;
    }
    return JavaErrorBundle.message("not.a.functional.interface", functionalInterfaceType.getPresentableText());
  }
public static @NlsContexts.DetailedDescription String checkInterfaceFunctional(@NotNull PsiElement context, @NotNull PsiType functionalInterfaceType)