@NotNull
  Stub deserialize(@NotNull InputStream stream) throws IOException, SerializerNotFoundException {
    FileLocalStringEnumerator storage = new FileLocalStringEnumerator(false);
    StubInputStream inputStream = new StubInputStream(stream, storage);

    @NotNull SerializationState state = readSerializationState(inputStream);
    if (stubStringInterner == null) {
      storage.read(inputStream);
    }
    else {
      storage.read(inputStream, stubStringInterner);
    }

    final int stubFilesCount = DataInputOutputUtil.readINT(inputStream);
    if (stubFilesCount <= 0) {
      Logger.getInstance(getClass()).error("Incorrect stub files count during deserialization:" + stubFilesCount);
    }

    Stub baseStub = deserializeRoot(inputStream, storage, state);
    List<PsiFileStub<?>> stubs = new ArrayList<>(stubFilesCount);
    if (baseStub instanceof PsiFileStub<?> fileStub) {
      stubs.add(fileStub);
    }
    for (int j = 1; j < stubFilesCount; j++) {
      Stub deserialize = deserializeRoot(inputStream, storage, state);
      if (deserialize instanceof PsiFileStub<?> fileStub) {
        stubs.add(fileStub);
      }
      else {
        Logger.getInstance(getClass()).error("Stub root must be PsiFileStub for files with several stub roots");
      }
    }
    PsiFileStub<?>[] stubsArray = stubs.toArray(PsiFileStub.EMPTY_ARRAY);
    for (PsiFileStub<?> stub : stubsArray) {
      if (stub instanceof PsiFileStubImpl<?> fileStub) {
        fileStub.setStubRoots(stubsArray);
      }
    }
    return baseStub;
  }
@NotNull
  Stub deserialize(@NotNull InputStream stream)