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

Peter Levart peter.levart at gmail.com
Sat Dec 9 20:14:28 UTC 2017



Peter Levart je 09. 12. 2017 ob 21:01 napisal:
> Hi Claes,
>
> Claes Redestad je 09. 12. 2017 ob 03:19 napisal:
>> Hi John,
>>
>> On 2017-12-09 02:20, John Rose wrote:
>>> On Dec 8, 2017, at 4:45 PM, John Rose <john.r.rose at oracle.com 
>>> <mailto:john.r.rose at oracle.com>> wrote:
>>>>
>>>> Can anyone point out a reason why the value based
>>>> lists of List.of() should serialize while the value based
>>>> lists of List.of().subList() should not?  Or is there some
>>>> reason we should not allow subList to produce value
>>>> based lists?
>
> One thing that might be implied from the specification that talks 
> about "...a view of the portion of this list between the specified 
> indexes..." is that the view keeps a reference to the original list. 
> This is observable if combined with Reference object(s). But I don't 
> know if this is an important behavioral detail that any code depends on.
>
> Regards, Peter

BTW, ImmutableCollections.AbstractImmutableList.SubList already violates 
that assumption and nobody is complaining.

Peter



More information about the core-libs-dev mailing list