RuedigerMoeller / fast-serialization

FST: fast java serialization drop in-replacement
Apache License 2.0
1.59k stars 247 forks source link

Cannot serialize externalizable class (RoaringBitmap) #245

Open marctinkler opened 6 years ago

marctinkler commented 6 years ago

We make extensive use of RoaringBitmaps (https://github.com/RoaringBitmap/RoaringBitmap) in our code, and we notice that they get corrupted when serialized via FST. They implement both Serializable and Externalizable.

Here's a simple example:


RoaringBitmap map = new RoaringBitmap();
map.add(1,2,3);             

FSTConfiguration config = FSTConfiguration.createDefaultConfiguration();                
RoaringBitmap read = (RoaringBitmap) config.getObjectInput(config.asByteArray(map)).readObject();

System.out.println("map1:"+ map);
System.out.println("map2:"+ read);

This will output: map1:{1,2,3} map2:{4096,1,2}

RuedigerMoeller commented 6 years ago

huh, for a workaround register a serializer. Its probably the edge case being serializable and externalizable ..