public <T extends PsiPolyVariantReference> ResolveResult @NotNull [] resolveWithCaching(@NotNull T ref,
                                                                                          @NotNull PolyVariantResolver<T> resolver,
                                                                                          boolean needToPreventRecursion,
                                                                                          boolean incompleteCode,
                                                                                          @NotNull PsiFile containingFile) {
    boolean isPhysical = containingFile.isPhysical();
    ProgressIndicatorProvider.checkCanceled();
    if (isPhysical) {
      ApplicationManager.getApplication().assertReadAccessAllowed();
    }
    int index = getIndex(isPhysical, incompleteCode, true);
    ResolveResult[] result = resolve(ref, getMap(index), needToPreventRecursion,
                                     () -> ((AbstractResolver<? super @NotNull T, ResolveResult[]>)resolver).resolve(ref, incompleteCode));
    return result == null ? ResolveResult.EMPTY_ARRAY : result;
  }
public <T extends PsiPolyVariantReference> ResolveResult @NotNull [] resolveWithCaching(@NotNull T ref,
                                                                                          @NotNull PolyVariantResolver<T> resolver,
                                                                                          boolean needToPreventRecursion,
                                                                                          boolean incompleteCode,
                                                                                          @NotNull PsiFile containingFile)