Closed GoogleCodeExporter closed 9 years ago
Gah that is terrible. Easy fix... ha! :p
Passing null to writeObjectOrNull(Output, Object) means the type of object has
been lost. Without the type, the method itself has to handle serializing null,
it can't delegate this to the serializer, which would be more efficient. This
is unfortunate because you would only call writeObjectOrNull when you really do
know the type, and also we already know the type in readObjectOrNull.
There are 2 solutions:
1) The method could be changed to writeObjectOrNull(Output, Object, Class) so
that the type is not lost. This method signature is a little ugly, but then
writeObjectOrNull is not used very often (which is obvious by the simple fact
that this issue exists!).
2) writeObjectOrNull and readObjectOrNull could be changed to handle nulls
without making use of the serializer. This is less efficient by 1 byte only
when the serialize accepts nulls AND references is false.
I went ahead and implemented #1, since the type should be known if
writeObjectOrNull is being called. Tests added.
Original comment by nathan.s...@gmail.com
on 31 May 2012 at 8:08
This issue was closed by revision r258.
Original comment by nathan.s...@gmail.com
on 31 May 2012 at 8:08
Looks good, thanks for fixing it so quickly! Any idea when you're cutting the
next release?
Original comment by pbak...@groupon.com
on 31 May 2012 at 8:51
Release 2.11 just now.
Original comment by nathan.s...@gmail.com
on 31 May 2012 at 11:02
Original issue reported on code.google.com by
pbak...@groupon.com
on 30 May 2012 at 11:21