Avi-Levi / kryo

Automatically exported from code.google.com/p/kryo
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Exception when serializing void.class #99

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Kryo k = new Kryo();
Output out = new Output(4096, Integer.MAX_VALUE);
k.writeClassAndObject(out, void.class);

What is the expected output? What do you see instead?
readClassAndObject should return void.class

What version of the Kryo are you using?
2.20, with Sun's Java 7 VM

Please provide any additional information below.

It seems void's class is not a class, at least on sun's vm. The following 
throws an exception:

if(!Class.class.isAssignableFrom(void.class))
     throw new RuntimeException("void's class is not a class");

Original issue reported on code.google.com by someguy...@gmail.com on 7 Dec 2012 at 12:29

GoogleCodeExporter commented 9 years ago
Fixed by revision r404.

It is now possible to do the following:
kryo.writeObject(out, Void.class);
kryo.readObject(in, Class.class); // equals Void.class

or

kryo.writeObject(out, void.class);
kryo.readObject(in, Class.class); // equals void.class

Original comment by romixlev on 26 Aug 2013 at 4:09