java/security should not create unmodifiable collections with redundant wrapping

XMLWordPrintable

    • Type: Bug
    • Resolution: Withdrawn
    • Priority: P4
    • 22
    • Affects Version/s: 17-pool, 21
    • Component/s: 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.

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

              Created:
              Updated:
              Resolved: