Closed GoogleCodeExporter closed 9 years ago
The stacktrace shows that you have constructed an EnumSerializer using a type
that is not an enum. I have added a better exception for this in r140.
I have added serialization of an enum using optional registration in r141. It
doesn't match your repro steps exactly, but does show the appropriate code is
working correctly. Further tests, not checked in, confirm your exact use case
works correctly.
Please post sample code if possible to show the problem.
Original comment by nathan.s...@gmail.com
on 28 Jan 2011 at 6:39
Here is a little code snippet. I am not sure if I am doing something wrong
here. I did not construct any serializer but used the default ones.
BTW, great library - I like it a lot.
import java.nio.ByteBuffer;
import com.esotericsoftware.kryo.Kryo;
public class KryoEnumTest {
public static void main(String[] args) {
Kryo kryo = new Kryo();
kryo.register(E.class);
ByteBuffer b = ByteBuffer.allocate(100);
kryo.writeObjectData(b, E.E1);
b.rewind();
E instance = kryo.readObjectData(b, E.class);
}
}
enum E {
E1 { }, //Assuming some method definitions go here - left blank for simplicity
E2 { };
}
Original comment by knowledg...@gmail.com
on 3 Feb 2011 at 5:25
Ah, I see. Interested bug. Fixed in r143. Thanks!
Original comment by nathan.s...@gmail.com
on 4 Feb 2011 at 2:31
Original issue reported on code.google.com by
knowledg...@gmail.com
on 28 Jan 2011 at 2:42