@Override
  public boolean isPotentiallyCompatible(@Nullable PsiType functionalInterfaceType) {
    final PsiMethod interfaceMethod = LambdaUtil.getFunctionalInterfaceMethod(functionalInterfaceType);
    if (interfaceMethod == null) return false;

    final MethodReferenceResolver resolver = new MethodReferenceResolver() {
      @Override
      protected PsiConflictResolver createResolver(@NotNull PsiMethodReferenceExpressionImpl referenceExpression,
                                                   @NotNull PsiMethodReferenceUtil.QualifierResolveResult qualifierResolveResult,
                                                   PsiMethod interfaceMethod,
                                                   MethodSignature signature) {
        return DuplicateConflictResolver.INSTANCE;
      }
    };

    ResolveResult[] result = LambdaUtil.performWithTargetType(this, functionalInterfaceType, () ->
      resolver.resolve(this, getContainingFile(), false));

    final PsiMethodReferenceUtil.QualifierResolveResult qualifierResolveResult = PsiMethodReferenceUtil.getQualifierResolveResult(this);
    final int interfaceArity = interfaceMethod.getParameterList().getParametersCount();
    for (ResolveResult resolveResult : result) {
      final PsiElement element = resolveResult.getElement();
      if (element instanceof PsiMethod) {
        final boolean isStatic = ((PsiMethod)element).hasModifierProperty(PsiModifier.STATIC);
        final int parametersCount = ((PsiMethod)element).getParameterList().getParametersCount();
        if (qualifierResolveResult.isReferenceTypeQualified() && getReferenceNameElement() instanceof PsiIdentifier) {
          int offset = isStatic ? 0 : 1;
          if (parametersCount == interfaceArity - offset) {
            return true;
          }
          if (((PsiMethod)element).isVarArgs() && (interfaceMethod.isVarArgs() || interfaceArity >= parametersCount + offset - 1)) {
            return true;
          }
        }
        else if (!isStatic) {
          if (parametersCount == interfaceArity) {
            return true;
          }
          if (((PsiMethod)element).isVarArgs() && (interfaceMethod.isVarArgs() || interfaceArity >= parametersCount - 1)) {
            return true;
          }
        }
      } else if (element instanceof PsiClass) {
        return true;
      }
    }
    return false;
  }
@Override
  public boolean isPotentiallyCompatible(@Nullable PsiType functionalInterfaceType)