PriorityQueue<String> foo = new PriorityQueue<>();
Kryo kryo = KryoKoinKt.buildKryoKoin();
File saveFile = new File("dat.bin");
Output o = new Output(new FileOutputStream(saveFile));
kryo.writeObject(o, foo);
o.close();
Input i = new Input(new FileInputStream(saveFile));
PriorityQueue<String> restored = kryo.readObject(i, PriorityQueue.class);
System.out.println(restored);
Expected: it should read the empty queue.
Observed:
Exception in thread "main" java.lang.IllegalArgumentException
at java.base/java.util.PriorityQueue.<init>(PriorityQueue.java:171)
at com.esotericsoftware.kryo.serializers.DefaultSerializers$PriorityQueueSerializer.createPriorityQueue(DefaultSerializers.java:746)
at com.esotericsoftware.kryo.serializers.DefaultSerializers$PriorityQueueSerializer.create(DefaultSerializers.java:738)
at com.esotericsoftware.kryo.serializers.DefaultSerializers$PriorityQueueSerializer.create(DefaultSerializers.java:732)
at com.esotericsoftware.kryo.serializers.CollectionSerializer.read(CollectionSerializer.java:216)
at com.esotericsoftware.kryo.serializers.CollectionSerializer.read(CollectionSerializer.java:44)
at com.esotericsoftware.kryo.Kryo.readObject(Kryo.java:774)
at KryoPrioMap.main(KryoPrioMap.java:25)
Describe the bug Consider the following example:
Expected: it should read the empty queue.
Observed:
Environment: