On Wed, 15 Mar 2023 18:56:11 GMT, Chen Liang <[email protected]> wrote:

>> TANSTAAFL
>> 
>> I suggest to leave the code as-is.
>
> True, my previous suggestion is largely trivial.
> 
> In addition, I suggest to run `replaceAll` to ensure the map elements of each 
> value of `namedMembers` is unmodifiable as well:
> 
> namedMembers.replaceAll((k, m) -> {
>     m.replaceAll((n, members) -> Collections.unmodifiableList(members));
>     return Collections.unmodifiableMap(m);
> });

@liach there's no need for namedMembers or its value maps to be unmodifiable: 
it's the lists that are exposed. So let's protect just them.

-------------

PR: https://git.openjdk.org/jdk/pull/13044

Reply via email to