RFR: 8180352: Add Stream.toList() method [v2]

Remi Forax forax at univ-mlv.fr
Wed Nov 18 12:14:58 UTC 2020


----- Mail original -----
> De: "Florian Weimer" <fw at deneb.enyo.de>
> À: "Peter Levart" <peter.levart at gmail.com>
> Cc: "Stuart Marks" <smarks at openjdk.java.net>, "core-libs-dev" <core-libs-dev at openjdk.java.net>
> Envoyé: Mercredi 18 Novembre 2020 12:55:02
> Objet: Re: RFR: 8180352: Add Stream.toList() method [v2]

> * Peter Levart:
> 
>> But I see that the new  IMM_LIST_NULLS type is needed for one other
>> thing - the immutable list implementation of that type has different
>> behavior of indexOf and lastIndexOf methods (it doesn't throw NPE when
>> null is passed to those methods) so this behavior has to be preserved in
>> the deserialized instance and there is not way to achieve that on old
>> JDK with existing serialization format, so there has to be an
>> incompatible change in the serialization format for that matter.
> 
> I think it's also needed for an efficient null element check in
> List::copyOf.  I have a hunch that with the posted implementation, it
> would incorrectly produce an immutable list that contains null
> elements.

yes !

Rémi


More information about the core-libs-dev mailing list