Serialization opt-in syntax (again)

Brian Goetz brian.goetz at
Mon Oct 1 21:26:27 PDT 2012

Unfortunately I do not believe the cost is negligible.  One of the downsides of our translation approach is that serialization overhead is higher.  For inner classes, it is just a matter of tagging the class as serializable, which is negligible.  But for our approach, we would have to carry more information in the lambda itself, and the "must be serializable" constraint also rules out several possible metafactory approaches.  Also, in our approach, serializable lambdas require a lot of additional static footprint in the capturing class to deal with the potential security issues.  Also, I believe that serialization really needs to be somethign users opt explicitly into.  Foisting transparent serializaxbility on users seems rude.  

Overall I do not see this as a realistic option.  

On Oct 1, 2012, at 1:10 PM, Zakharov, Vladimir wrote:

> Excellent question. What is the cost and under what circumstances will it be incurred? I suspect, based on our experience with GS Collections, where all interfaces extend Serializable (including Predicates, Functions, etc.), the practical cost would be negligible.
> The Goldman Sachs Group, Inc. All rights reserved.
> See for important risk disclosures, conflicts of interest and other terms and conditions relating to this e-mail and your reliance on information contained in it.  This message may contain confidential or privileged information.  If you are not the intended recipient, please advise us immediately and delete this message.  See for further information on confidentiality and the risks of non-secure electronic communication.  If you cannot access these links, please notify us by reply message and we will send the contents to you. 
> From: lambda-spec-experts-bounces at [mailto:lambda-spec-experts-bounces at] On Behalf OfKevin Bourrillion
> Sent: Monday, October 01, 2012 12:12 PM
> To: Brian Goetz
> Cc: lambda-spec-experts at
> Subject: Re: Serialization opt-in syntax (again)
> On Mon, Oct 1, 2012 at 8:57 AM, Kevin Bourrillion <kevinb at> wrote:
> And AFAIK, having all lambdas be serializable and having no lambdas be serializable are still not considered viable. So we're really in a tough spot.
> Actually, given the horrors we're discussing here, let's be sure about this.  If all lambdas were serializable it would be a get out of jail free card for this design conundrum, so I must ask:  are we all satisfied that we have accurately quantified just how bad it would be performance-wise?  If so: how bad?
> --
> Kevin Bourrillion | Java Librarian | Google, Inc. | kevinb at

-------------- next part --------------
An HTML attachment was scrubbed...

More information about the lambda-spec-experts mailing list