JDK-8312630 : java/security should not create unmodifiable collections with redundant wrapping
  • Type: Bug
  • Component: security-libs
  • Sub-Component: java.security
  • Affected Version: 17-pool,21
  • Priority: P4
  • Status: In Progress
  • Resolution: Unresolved
  • Submitted: 2023-07-25
  • Updated: 2023-07-25
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 22
22Unresolved
Related Reports
Relates :  
Description
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.
Comments
A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/15008 Date: 2023-07-25 06:27:25 +0000
25-07-2023