Export to GitHub

kryo - issue #99

Exception when serializing void.class


Posted on Dec 7, 2012 by Swift Rhino

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");

Comment #1

Posted on Aug 26, 2013 by Swift Horse

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

Status: Fixed

Labels:
Type-Defect Priority-Medium