I have a java class serialized using kryo-shaded 4.0.1
class definition :
class A{
private int c1;
private Map<Integer, String> c2;
}
After serialization when I deserialized its fine,But if If after serilization using existing definition and then add new field as
class A{
private int c1;
private Map<Integer, String> c2;
private Map<Integer, String> c3;
}
And then tries to deserialize existing serialized content(serialized using old definition) it throws
com.esotericsoftware.kryo.KryoException: Buffer underflow.
Serialization trace:
....
at com.esotericsoftware.kryo.io.Input.require(Input.java:199)
at com.esotericsoftware.kryo.io.Input.readVarInt(Input.java:373)
at com.esotericsoftware.kryo.util.DefaultClassResolver.readClass(DefaultClassResolver.java:127)
at com.esotericsoftware.kryo.Kryo.readClass(Kryo.java:693)
at com.esotericsoftware.kryo.serializers.ObjectField.read(ObjectField.java:118)
at com.esotericsoftware.kryo.serializers.FieldSerializer.read(FieldSerializer.java:543)
at com.esotericsoftware.kryo.Kryo.readObject(Kryo.java:709)
My code is thread safe as I am using Kryopool. Does kryo not support schema evolution.