public <T extends PsiPolyVariantReference> ResolveResult @NotNull [] resolveWithCaching(@NotNull T ref,
                                                                                          @NotNull PolyVariantContextResolver<T> resolver,
                                                                                          boolean needToPreventRecursion,
                                                                                          boolean incompleteCode,
                                                                                          @NotNull PsiFile containingFile) {
    ProgressIndicatorProvider.checkCanceled();
    ApplicationManager.getApplication().assertReadAccessAllowed();

    boolean isPhysical = containingFile.isPhysical();
    int index = getIndex(isPhysical, incompleteCode, true);
    Map<T, ResolveResult[]> map = getMap(index);
    ResolveResult[] results = resolve(ref, map, needToPreventRecursion, () -> resolver.resolve(ref, containingFile, incompleteCode));
    return results == null ? ResolveResult.EMPTY_ARRAY : results;
  }
public <T extends PsiPolyVariantReference> ResolveResult @NotNull [] resolveWithCaching(@NotNull T ref,
                                                                                          @NotNull PolyVariantContextResolver<T> resolver,
                                                                                          boolean needToPreventRecursion,
                                                                                          boolean incompleteCode,
                                                                                          @NotNull PsiFile containingFile)