Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8312630

java/security should not create unmodifiable collections with redundant wrapping

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Withdrawn
    • Icon: P4 P4
    • 22
    • 17-pool, 21
    • security-libs

      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.

            jjiang John Jiang
            jjiang John Jiang
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: