private @NotNull ObjectStubSerializer<Stub, Stub> writeSerializerId(Stub stub, @NotNull DataOutput stream, @NotNull SerializationState state)
    throws IOException {
    ObjectStubSerializer<Stub, Stub> serializer = StubSerializationUtil.getSerializer(stub);
    if (serializer == null) {
      throw new Error("No serializer was returned for " + stub);
    }
    int localId = writeSerializerId(serializer, state);
    DataInputOutputUtil.writeINT(stream, localId);
    return serializer;
  }
private @NotNull ObjectStubSerializer<Stub, Stub> writeSerializerId(Stub stub, @NotNull DataOutput stream, @NotNull SerializationState state)