RFR: 8312630: java/security should not create unmodifiable collections with redundant wrapping [v2]
John Jiang
jjiang at openjdk.org
Wed Jul 26 09:28:46 UTC 2023
> 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
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/15008/files
- new: https://git.openjdk.org/jdk/pull/15008/files/64f607da..b8f2d9e0
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=15008&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=15008&range=00-01
Stats: 11 lines in 4 files changed: 0 ins; 2 del; 9 mod
Patch: https://git.openjdk.org/jdk/pull/15008.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/15008/head:pull/15008
PR: https://git.openjdk.org/jdk/pull/15008
More information about the security-dev
mailing list