[10?] RFR: 8193128: Reduce number of implementation classes returned by List/Set/Map.of()

John Rose john.r.rose at oracle.com
Fri Dec 22 20:04:52 UTC 2017

On Dec 22, 2017, at 11:57 AM, John Rose <john.r.rose at oracle.com> wrote:
> On Dec 21, 2017, at 5:31 PM, Stuart Marks <stuart.marks at oracle.com> wrote:
>> I'd like a blanket assertion that view collections are not serializable.
>> Now this should be considered distinct from whether view collections are value-based; I'm fine with considering view collections to be value-based. It's just that some value-based collections are serializable and others aren't. In particular, given a serializable, value-based list, a sublist should not be serializable but it can be value-based. A sublist of a sublist should also not be serializable and can be value-based, and in this case we can do short-circuiting such as 'return this' if we like.
> The two concerns can be separated, but they necessarily
> have a priority, and I think you have got the priority backward.
> Here's the way I see it:
> 1. Value-based aggregates are inherently lossless when
> serialized, and so should (in general) be made serializable.
> 2. Views are generally lossy when serialized, *if the backing
> store has a significant identity*, and should (in general) not
> be made serializable.
> If we are going to make blanket statements, I claim the first
> is more fundamental than the second.  The second has
> priority only in history, since serialization was invented before
> the value-based distinction.
> I think we should apply the rules in logical order 1, then 2,
> not historical order 2, then 1.

P.S. I am talking about serialization as a general thing with
a future.  If you are talking only about legacy serialization,
then I can see there might be historical influences that would
invert the flow of the above logic.  Still, I'd like to tweak
legacy serialization in better directions AFAP, even if its
ultimately futile, so that when we come up with something
better we will have relatively more good precedents to

More information about the core-libs-dev mailing list