docs: private void register(Kryo kryo, Class<?>[] types, Serializer<?> serializer, int id) {
      Registration existing = kryo.getRegistration(id);
      if (existing != null) {
        boolean matches = false;
        for (Class<?> type : types) {
          if (existing.getType() == type) {
            matches = true;
            break;
          }
        }
  
        if (!matches) {
          LOGGER.error("{}: Failed to register {} as {}, {} was already registered.",
              friendlyName(), types, id, existing.getType());
  
          throw new IllegalStateException(String.format(
              "Failed to register %s as %s, %s was already registered.",
              Arrays.toString(types), id, existing.getType()));
        }
        // falling through to register call for now.
        // Consider skipping, if there's reasonable
        // way to compare serializer equivalence.
      }
  
      for (Class<?> type : types) {
        Registration r = null;
        if (serializer == null) {
          r = kryo.register(type, id);
        } else if (type.isInterface()) {
          kryo.addDefaultSerializer(type, serializer);
        } else {
          r = kryo.register(type, serializer, id);
        }
        if (r != null) {
          if (r.getId() != id) {
            LOGGER.debug("{}: {} already registered as {}. Skipping {}.",
                friendlyName(), r.getType(), r.getId(), id);
          }
          LOGGER.trace("{} registered as {}", r.getType(), r.getId());
        }
      }
    }