On Wed, 26 Jul 2023 09:28:46 GMT, John Jiang <jji...@openjdk.org> wrote:
>> Some java/security classes apply the below coding style, >> >> Set<T> set = ...; >> Set<T> unmodifiableSet = Collections.unmodifiableSet(new HashSet<>(set)); >> >> It may be unnecessary to wrap that `set` with HashSet before creating >> `unmodifiableSet`. >> Some usages on `Collections.unmodifiableList` and >> `Collections.unmodifiableMap` have the same issue. > > John Jiang has updated the pull request incrementally with one additional > commit since the last revision: > > use copyOf instead of modifiableXXX src/java.base/share/classes/java/security/KeyStore.java line 769: > 767: } > 768: this.cert = trustedCert; > 769: this.attributes = Set.copyOf(attributes); Similar comments. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/15008#discussion_r1275083599