Lambdas and serialization
brian.goetz at oracle.com
Wed Oct 20 09:12:48 PDT 2010
All this is true, but I don't think this slams the door on lambdas being serializable. Inner classes are serializable now, and while their serialized form is compiler-specific, people do get useful work done with them (such as, by ensuring you have the same version of all classes on both sides of an RMI connection.) As far as I can see, the proposed serializability requirement of lambdas would put them in the same boat as inner classes, which, while not perfect, is not any worse than things are right now.
On Oct 19, 2010, at 3:40 PM, Bob Lee wrote:
> On Tue, Oct 19, 2010 at 3:33 PM, Alessio Stalla <alessiostalla at gmail.com> 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.
More information about the lambda-dev