use of io.paperdb.serializer.NoArgCollectionSerializer in project Paper by pilgr.
the class DbStoragePlainFile method createKryoInstance.
private Kryo createKryoInstance() {
Kryo kryo = new Kryo();
kryo.register(PaperTable.class);
kryo.setDefaultSerializer(CompatibleFieldSerializer.class);
kryo.setReferences(false);
// Serialize Arrays$ArrayList
//noinspection ArraysAsListWithZeroOrOneArgument
kryo.register(Arrays.asList("").getClass(), new ArraysAsListSerializer());
UnmodifiableCollectionsSerializer.registerSerializers(kryo);
SynchronizedCollectionsSerializer.registerSerializers(kryo);
// Serialize inner AbstractList$SubAbstractListRandomAccess
kryo.addDefaultSerializer(new ArrayList<>().subList(0, 0).getClass(), new NoArgCollectionSerializer());
// Serialize AbstractList$SubAbstractList
kryo.addDefaultSerializer(new LinkedList<>().subList(0, 0).getClass(), new NoArgCollectionSerializer());
// To keep backward compatibility don't change the order of serializers above
// UUID support
kryo.register(UUID.class, new UUIDSerializer());
for (Class<?> clazz : mCustomSerializers.keySet()) kryo.register(clazz, mCustomSerializers.get(clazz));
kryo.setInstantiatorStrategy(new Kryo.DefaultInstantiatorStrategy(new StdInstantiatorStrategy()));
return kryo;
}
Aggregations