private static @NotNull FileContentImpl getUnsavedDocContent(@NotNull Document document,
                                                               @NotNull Project project,
                                                               @NotNull VirtualFile vFile,
                                                               long currentDocStamp,
                                                               @NotNull CharSequence contentText) {
    // Reasonably attempt to use the same file content when calculating indices
    // as we can evaluate them several at once and store in file content
    WeakReference<Pair<FileContentImpl, Long>> previousContentAndStampRef = document.getUserData(ourFileContentKey);
    Pair<FileContentImpl, Long> previousContentAndStamp = SoftReference.dereference(previousContentAndStampRef);

    if (previousContentAndStamp != null && currentDocStamp == previousContentAndStamp.getSecond()) {
      FileContentImpl existingFC = previousContentAndStamp.getFirst();
      if (project.equals(existingFC.getProject())) {
        return existingFC;
      }
    }

    FileContentImpl newFc = (FileContentImpl)FileContentImpl.createByText(vFile, contentText, project);
    document.putUserData(ourFileContentKey, new WeakReference<>(Pair.create(newFc, currentDocStamp)));
    return newFc;
  }
private static @NotNull FileContentImpl getUnsavedDocContent(@NotNull Document document,
                                                               @NotNull Project project,
                                                               @NotNull VirtualFile vFile,
                                                               long currentDocStamp,
                                                               @NotNull CharSequence contentText)