private static JavaResolveResult getStaticFactoryCandidateInfo(@NotNull PsiNewExpression newExpression,
                                                                 final PsiElement context) {
    return ourDiamondGuard.doPreventingRecursion(context, false, () -> {

      final PsiExpressionList argumentList = newExpression.getArgumentList();
      if (argumentList == null) {
        //token expected diagnostic is provided by parser
        return null;
      }

      PsiFile containingFile = argumentList.getContainingFile();
      if (containingFile == null) {
        return null;
      }
      JavaMethodsConflictResolver resolver = new JavaMethodsConflictResolver(argumentList, null,
                                                                             PsiUtil.getLanguageLevel(containingFile),
                                                                             containingFile);
      final List<CandidateInfo> results = collectStaticFactories(newExpression);
      CandidateInfo result = results != null ? resolver.resolveConflict(new ArrayList<>(results)) : null;
      final PsiMethod staticFactory = result != null ? (PsiMethod)result.getElement() : null;
      if (staticFactory == null) {
        //additional diagnostics: inference fails due to unresolved constructor
        return JavaResolveResult.EMPTY;
      }

      final MethodCandidateInfo staticFactoryCandidateInfo = createMethodCandidate((MethodCandidateInfo)result, context, false, argumentList);
      if (!staticFactory.isVarArgs()) {
        return staticFactoryCandidateInfo;
      }

      final ArrayList<CandidateInfo> conflicts = new ArrayList<>();
      conflicts.add(staticFactoryCandidateInfo);
      conflicts.add(createMethodCandidate((MethodCandidateInfo)result, context, true, argumentList));
      return resolver.resolveConflict(conflicts);
    });
  }
private static JavaResolveResult getStaticFactoryCandidateInfo(@NotNull PsiNewExpression newExpression,
                                                                 final PsiElement context)