On 21/09/2017 01:02, Stuart Marks wrote:
(also includes 8184690: add Collectors for collecting into unmodifiable List, Set, and Map)

Hi all,

Please review the following changeset with specification changes to support the following:

* new List.copyOf(), Set.copyOf(), and Map.copyOf() "copy factory" methods

* new Collectors.toUnmodifiableList, Set, and Map methods

* specification revisions to provide clearer definitions of "view" collections, "unmodifiable" collections, and "unmodifiable views"

The specification text has walked back most uses of "immutable", changing many occurrences to "unmodifiable". (People thought that putting a mutable object into an immutable collection would somehow magically make the whole thing immutable. Also, there was continual confusion with "immutable persistent" data structures.)

This review is mainly about specification. Minimal implementations are included, but no tests. Those will come later.

Webrev:

    http://cr.openjdk.java.net/~smarks/reviews/8177290/webrev.0/
I read through the updated/new definitions and they read well.

For the copyOf methods then I can't immediately tell from the javadoc if the given collection can contain null elements. Taking List.copyOf as an example where coll may be null or it may contain null elements. The javadoc does link to "Unmodifiable lists" where it specifies the characteristics of the lists returned by the static factory methods - these include disallowing null elements. So I think this needs to be clarified.

Minimal implementation is okay to get started but what is the reason not to include some basic tests?

-Alan

Reply via email to