With gson 2.2.2 google introduced a StringMap<V> which extends AbstractMap<String, V>. Kryo seems to assume the wrong number of generics for this class.
The error occured with serializing a JsonObject of JsonObjects.
Have a look at the discussion here: https://groups.google.com/forum/?fromgroups=#!topic/kryo-users/GJWr6DB2cco
Comment #1
Posted on Oct 12, 2012 by Swift HorseHi,
I think I have a solution for it.
I created a code that properly derives which concrete classes are used for which generic type arguments. I added support for it into MapSerializer and CollectionSerializer. Seems to work fine for me. And it produces smaller serialized representations if it can automatically derive that types of keys, values or elements have a concrete final type. For example, if you have a class like this:
public class StringMap extends HashMap { }
When you serialize object of this class, no class information will be written for keys and values. Only the string values.
@Nate: Once you have time and mood to review new patches, please let me know, and I'll submit a patch for your review.
Comment #2
Posted on Oct 24, 2012 by Swift HorsePlease find attached a patch for this problem. Seems to work for me.
- kryo-collection-generics.patch 14.86KB
Comment #3
Posted on Nov 15, 2012 by Happy CatThe patch seems to work fine, when using the always same constelation of generics for one class (e.g. Map), but fails when another combination of generics occurs. This is indicated by the JUnitTests delivered with Kryo. One of my coworkes fixed it, using your patch. Now, all JUnitTests are working correctly.
Status: New
Labels:
Type-Defect
Priority-Medium