public static boolean isPassthroughMethod(@Nullable PsiMethod method,
                                            @Nullable UCallExpression call,
                                            @Nullable UExpression arg,
                                            @NotNull RestrictionInfoFactory<?> factory) {
    if (method == null) return false;
    PsiType type = method.getReturnType();
    PsiTypeParameter typeParameter = ObjectUtils.tryCast(PsiUtil.resolveClassInClassTypeOnly(type), PsiTypeParameter.class);
    if (typeParameter != null && typeParameter.getExtendsList().getReferencedTypes().length == 0) {
      PsiParameter[] parameters;
      if (arg == null || call == null) {
        parameters = method.getParameterList().getParameters();
      }
      else {
        PsiParameter parameter = AnnotationContext.getParameter(call, arg);
        if (parameter == null) return false;
        PsiType parameterType = parameter.getType();
        PsiElement psi = call.getSourcePsi();
        if (psi instanceof PsiMethodCallExpression) {
          PsiSubstitutor substitutor = ((PsiMethodCallExpression)psi).getMethodExpression().advancedResolve(false).getSubstitutor();
          parameterType = substitutor.substitute(parameterType);
        }
        RestrictionInfo info = factory.fromAnnotationOwner(parameterType);
        if (info.getKind() != RestrictionInfo.RestrictionInfoKind.UNKNOWN) {
          return false;
        }
        parameters = new PsiParameter[]{parameter};
      }
      for (PsiParameter parameter : parameters) {
        PsiType parameterType = parameter.getType();
        if (type.equals(GenericsUtil.getVariableTypeByExpressionType(parameterType))) return true;
        PsiType returnType = GenericsUtil.getVariableTypeByExpressionType(LambdaUtil.getFunctionalInterfaceReturnType(parameterType));
        if (type.equals(returnType)) return true;
      }
    }
    return isKotlinPassthroughMethod(method);
  }
public static boolean isPassthroughMethod(@Nullable PsiMethod method,
                                            @Nullable UCallExpression call,
                                            @Nullable UExpression arg,
                                            @NotNull RestrictionInfoFactory<?> factory)