Stephen Colebourne wrote:

Workarounds include lazily creating the caches in transient fields, bloating the serialzed data, using reflection or creating a dummy inner class to act as the serialized form. All are rubbish solutions.

IMO, a "serial proxy" is a good rubbish solution. Nested classes aren't great for serialisation - I suggest a "package private" outer class.

A big issue here is that readObject is not a real constructor. It should be. Although even that wouldn't solve all the problems that serial proxies can verbosely (or instance, determining actual implementation class).

Tom

Reply via email to