@SuppressWarnings("LambdaUnfriendlyMethodOverload")
  public @Nullable <TRef extends PsiReference, TResult> TResult resolveWithCaching(@NotNull TRef ref,
                                                                                   @NotNull AbstractResolver<TRef, TResult> resolver,
                                                                                   boolean needToPreventRecursion,
                                                                                   boolean incompleteCode) {
    boolean isPhysical = ref.getElement().isPhysical();
    ProgressIndicatorProvider.checkCanceled();
    if (isPhysical) {
      ApplicationManager.getApplication().assertReadAccessAllowed();
    }
    int index = getIndex(isPhysical, incompleteCode, false);
    return resolve(ref, getMap(index), needToPreventRecursion, () -> resolver.resolve(ref, incompleteCode));
  }
@SuppressWarnings("LambdaUnfriendlyMethodOverload")
  public @Nullable <TRef extends PsiReference, TResult> TResult resolveWithCaching(@NotNull TRef ref,
                                                                                   @NotNull AbstractResolver<TRef, TResult> resolver,
                                                                                   boolean needToPreventRecursion,
                                                                                   boolean incompleteCode)