RFR 8009736: Comparator API cleanup

Tom Hawtin tom.hawtin at oracle.com
Mon Jun 17 09:36:58 PDT 2013


On 15/06/2013 01:56, Brian Goetz wrote:
> Yeah, but once you make one not-serializable, there's no way to
> un-not-serializable it.  (Serializable is a misnomer; really what we
> have is the ability to say "not serialization-hostile.")  So if any ever
> need to be serializable, we either need to make them all so, or have two
> versions of each factory/combinator.  Awful options all around.

Certainly for a subclassable type, making it Serializable after fcs 
breaks expectations that can reasonably be made. I don't see your point 
when considering "package private", private or final classes.

Like it or somewhat more likely not, once you make a type in an API 
package serialisable it is in the public API (except Swing). Even if it 
isn't in an API package, people (possibly the Java Class Library) will 
still use it. As serialisation stands (and it's not likely anyone is 
going to be keen on messing with it) you may want an API serial proxy to 
go along with your real hidden implementation.

Tom


More information about the lambda-dev mailing list