Serialization opt-in syntax (summary)

Brian Goetz brian.goetz at
Fri Oct 12 09:06:52 PDT 2012

I don't even agree that posterity would prefer it the other way, since there still are inner classes and many users have learned to deal with the frustrating interaction between inner classes and serialization.  A more accurate statement is that posterity would have preferred we not make the mistakes of the past the first time, but absent a time machine, we're kind of stuck there.  

In any case, I don't think "lambdas cannot be serializable" is a realistic option at this point.  Users will expect:

  SerializablePredicate p = x -> true

to be serializable -- and entirely reasonably so.  We made a commitment to SAM conversion a long time ago, and part of that is users should not have to reason about "how was this SAM constructed -- did it come from a lambda or a class?"  Otherwise it is a leaky abstraction.  Yes, serialization sucks -- and we're copying the suckage mode that users have spent 15 years getting used to.  But that 15 years of user community experience matters -- users have learned how to deal with the limitations, and there is a lot of value in not asking users to learn new and different limitations (especially those that punish the users who learned to live within the old limitations.)  

The EG took a poll on this at the July meeting last year, and was unanimously in favor of the "weak serialization" target.  David wasn't at that meeting, which is too bad, but I just don't see enough new evidence to reopen this issue now.  

However, we can and should spend our effort on "how can we make things as good as we can subject to the 'no worse than inner classes' rubric.  I suggest we redirect our efforts towards that.  Choosing a less-brittle translation strategy is a good place to start.  

On Oct 12, 2012, at 4:46 PM, Kevin Bourrillion wrote:

> On 10/12/2012 09:37 AM, Brian Goetz wrote:
> I keep going back to the rubric of "no worse than inner classes."
> On Fri, Oct 12, 2012 at 8:17 AM, David M. Lloyd <david.lloyd at> wrote:
> And I keep going back to "making the mistake once does not justify making it again"...
> Ha. I completely see the sense in both of these mindsets.
> Posterity hugely prefers that we see it the second way; yet here we are in the present tense and we have to get something working and deliver it. Is that the conflict we're having?
> -- 
> Kevin Bourrillion | Java Librarian | Google, Inc. | kevinb at

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

More information about the lambda-spec-experts mailing list