Lambdas and serialization

Mark Wielaard mark at
Wed Oct 20 00:55:05 PDT 2010

On Tue, 2010-10-19 at 15:40 -0700, Bob Lee wrote:
> On Tue, Oct 19, 2010 at 3:33 PM, Alessio Stalla <alessiostalla at>wrote:
> > Well, but then the serializable form of any java.* class is not
> > necessarily compatible between different JVMs, again because the
> > internal details might be different. Default serialization is not
> > meant as a standard storage format, rather as a means to store a graph
> > of objects into a sequence of bytes and restore it later *using the
> > same JVM*.

> That's actually not true. If a class is serializable, its serialized form is
> part of the published API, and you are guaranteed compatibility across VMs
> and VM versions.

But not all serialized forms are published. For example it is not
specified how precisely an inner class is transformed to byte code
(compiler generated methods/fields can have different names) so using
different java source to byte code compilers might result in different
serialized forms. And sometimes constructs use (undocumented) internal
implementation classes for serialization like Annotations (which uses
sun.reflect.annotation which isn't guaranteed to be compatible across
independent implementations).



More information about the lambda-dev mailing list