public static boolean isUncheckedWarning(@NotNull PsiJavaCodeReferenceElement expression,
                                           @NotNull JavaResolveResult resolveResult,
                                           @NotNull LanguageLevel languageLevel) {
    final PsiElement resolve = resolveResult.getElement();
    if (!(resolve instanceof PsiMethod)) {
      return false;
    }
    PsiMethod psiMethod = (PsiMethod)resolve;

    PsiParameter[] parameters = psiMethod.getParameterList().getParameters();

    int parametersCount = parameters.length;
    if (parametersCount == 0) {
      return false;
    }
    PsiParameter varargParameter = parameters[parametersCount - 1];
    if (!varargParameter.isVarArgs()) {
      return false;
    }

    if (AnnotationUtil.isAnnotated(psiMethod, CommonClassNames.JAVA_LANG_SAFE_VARARGS, CHECK_EXTERNAL)) {
      return false;
    }

    PsiType componentType = ((PsiEllipsisType)varargParameter.getType()).getComponentType();
    if (isReifiableType(resolveResult.getSubstitutor().substitute(componentType))) {
      return false;
    }

    if (expression instanceof PsiMethodReferenceExpression) return true;

    final PsiElement parent = expression.getParent();
    if (parent instanceof PsiCall) {
      final PsiExpressionList argumentList = ((PsiCall)parent).getArgumentList();
      if (argumentList != null) {
        final PsiExpression[] args = argumentList.getExpressions();
        if (args.length == parametersCount) {
          final PsiExpression lastArg = args[args.length - 1];
          if (lastArg.getType() instanceof PsiArrayType) {
            return false;
          }
        }
        for (int i = parametersCount - 1; i < args.length; i++) {
          if (!isReifiableType(resolveResult.getSubstitutor().substitute(args[i].getType()))) {
            return true;
          }
        }
        return args.length < parametersCount;
      }
    }
    return false;
  }
public static boolean isUncheckedWarning(@NotNull PsiJavaCodeReferenceElement expression,
                                           @NotNull JavaResolveResult resolveResult,
                                           @NotNull LanguageLevel languageLevel)