When I'm using PriorityQueueSerializer from chill-java package, I got NPE when serializing PriorityQueue instance like this:
PriorityQueue<String> pq = new PriorityQueue<>((o1, o2) -> o1.length() - o2.length() - 1);
pq.add("1234135");
pq.add("12323424135");
java.lang.NullPointerException
at com.esotericsoftware.kryo.util.DefaultClassResolver.writeClass(DefaultClassResolver.java:80)
at com.esotericsoftware.kryo.Kryo.writeClass(Kryo.java:488)
at com.esotericsoftware.kryo.Kryo.writeClassAndObject(Kryo.java:593)
Perhaps it's because the lambda expression is not serializable. But the strange thing is that when I removed the registration of PriorityQueueSerializer from kryo's registrations, the serialization works.
Is this expected?