Skip to content

CompatibleSerializer Issue when upgraded to 5.0 #744

@f2014440

Description

@f2014440

Currently we are using kryo version: "com.esotericsoftware:kryo:5.0.0-RC4" but when I upgraded to "com.esotericsoftware:kryo:5.0.0-RC5" our test cases are failing. These is our serializer configs:

kryoPool = new Pool<Kryo>(true, true) {
      protected Kryo create() {
        Kryo kryo = new Kryo();
        kryo.setRegistrationRequired(false);
        kryo.setReferences(false);
        kryo.setCopyReferences(false);
        kryo.setInstantiatorStrategy(new StdInstantiatorStrategy());
        CompatibleFieldSerializer.CompatibleFieldSerializerConfig config = new CompatibleFieldSerializer.CompatibleFieldSerializerConfig();
        config.setChunkedEncoding(true);
        config.setReadUnknownFieldData(true);
        kryo.setDefaultSerializer(new SerializerFactory.CompatibleFieldSerializerFactory(config));
        return kryo;
      }

We are using compatibleSerializer and I saw that to resolve one of the issue there was a change made in CompatibleSerializer's write method(link: 4ea2a8a). I think this change is failing test cases. In version it used to get specific class but now it takes type which is Java.lang.Object for us. So while writing nested object using compatibleSerializer it's not able to register the nested object in CacheFields and not able to encode it.
This is the object we want to encode and decode:

public class CacheObject {

  @JsonFormat(shape = JsonFormat.Shape.STRING)
  private Date stored;
  private long ttl;
  private Object value;

  public CacheObject() { }

  public CacheObject(Date stored, long ttl, Object value) {
    this.stored = stored;
    this.ttl = ttl;
    this.value = value;
  }

  public Date getStored() {
    return stored;
  }

  public long getTtl() {
    return ttl;
  }

  public Object getValue() {
    return value;
  }
}

For the object which is inside "value" attribute it's not able to initialize CacheFields and that's why not able to write that object.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions