docs: public static <T extends Serializable> T deserializeAndCheckObject(final byte[] object, final Class<T> type) {
          val result = deserialize(object, type);
          if (!type.isAssignableFrom(result.getClass())) {
              throw new ClassCastException("Decoded object is of type " + result.getClass() + " when we were expecting " + type);
          }
          return (T) result;
      }