On Wed, 26 Jul 2023 16:52:20 GMT, Sean Mullan wrote:
> The latter part is true (prevented from subsequent modification) but, unless
> I am mistaken, the former (making a clone/copy) is not. For example, before
> your change, this assert would pass:
>
> ```
> Map m = Collections.unmodifiableMap
On Wed, 26 Jul 2023 16:03:31 GMT, John Jiang wrote:
> > it says "It is cloned to prevent subsequent modification."
> > Now, if the set passed in is unmodifiable, that is no longer true.
>
> My understanding: The parameter `protectionParams` is cloned as
> `this.protectionParams`, and `this.prot
On Wed, 26 Jul 2023 09:28:46 GMT, John Jiang wrote:
>> Some java/security classes apply the below coding style,
>>
>> Set set = ...;
>> Set unmodifiableSet = Collections.unmodifiableSet(new HashSet<>(set));
>>
>> It may be unnecessary to wrap that `set` with HashSet before creating
>> `unmodif
On Wed, 26 Jul 2023 14:41:16 GMT, Sean Mullan wrote:
> it says "It is cloned to prevent subsequent modification."
> Now, if the set passed in is unmodifiable, that is no longer true.
My understanding:
The parameter `protectionParams` is cloned as `this.protectionParams`,
and `this.protectionPar
On Wed, 26 Jul 2023 09:28:46 GMT, John Jiang wrote:
>> Some java/security classes apply the below coding style,
>>
>> Set set = ...;
>> Set unmodifiableSet = Collections.unmodifiableSet(new HashSet<>(set));
>>
>> It may be unnecessary to wrap that `set` with HashSet before creating
>> `unmodif
> Some java/security classes apply the below coding style,
>
> Set set = ...;
> Set unmodifiableSet = Collections.unmodifiableSet(new HashSet<>(set));
>
> It may be unnecessary to wrap that `set` with HashSet before creating
> `unmodifiableSet`.
> Some usages on `Collections.unmodifiableList` an