private static boolean isMethodCallTypeDependsOnInference(PsiExpression expression, PsiMethod method) {
    final Set<PsiTypeParameter> typeParameters = ContainerUtil.newHashSet(method.getTypeParameters());
    if (!typeParameters.isEmpty()) {
      final PsiType returnType = method.getReturnType();
      if (returnType != null) {
        return PsiTypesUtil.mentionsTypeParameters(returnType, typeParameters);
      }
    }
    else if (method.isConstructor() && expression instanceof PsiNewExpression && PsiDiamondType.hasDiamond((PsiNewExpression)expression)) {
      return true;
    }
    return false;
  }
private static boolean isMethodCallTypeDependsOnInference(PsiExpression expression, PsiMethod method)