boolean (@NotNull PsiType functionalInterfaceType, @NotNull Set<? extends PsiTypeParameter> parameters) { if (!(functionalInterfaceType instanceof PsiClassType classType)) return false; PsiSubstitutor substitutor = classType.resolveGenerics().getSubstitutor(); PsiMethod method = LambdaUtil.getFunctionalInterfaceMethod(functionalInterfaceType); if (method == null) return false; for (PsiParameter parameter : method.getParameterList().getParameters()) { if (PsiTypesUtil.mentionsTypeParameters(substitutor.substitute(parameter.getType()), parameters)) return true; } return false; }