Serialization

Joshua Bloch jjb at google.com
Wed Dec 16 07:46:14 PST 2009


Folks,

Associating a class name with a closure is only half the battle.  Loosely
speaking, it takes you from serializing an anonymous class instance to a
named *non-static* nested class.  But even the latter is generally
considered a bad idea, because you end up serializing the enclosing
instance, which is rarely what you want. The serializable SAM interfaces
that we use in MapReduce are typically nested *static *classes (hence no
enclosing instance). I'd argue that this is a reasonable restriction for
serializable function objects (the static part, not the nested part).

               Josh


More information about the lambda-dev mailing list