@Nonnull
    public TypeSerializer<T> getSerializer() {
        return typeSerializer.duplicate();
    }
@Test
    void testSerializerDuplication() {
        // we need a serializer that actually duplicates for testing (a stateful one)
        // we use Kryo here, because it meets these conditions
        TestStateDescriptor<String> descr =
                new TestStateDescriptor<>("foobar", new GenericTypeInfo<>(String.class));

        TypeSerializer<String> serializerA = descr.getSerializer();
        TypeSerializer<String> serializerB = descr.getSerializer();

        // check that the retrieved serializers are not the same
        assertThat(serializerB).isNotSameAs(serializerA);
    }