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

List.copyOf() fails to copy sublists

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 11
    • Fix Version/s: 11
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Introduced In Build:
      b07
    • Resolved In Build:
      b20
    • Verification:
      Verified

      Backports

        Description

        Recent changes (JDK-8193128) to the unmodifiable collections changed the sublist implementation. This has the side effect of causing List.copyOf() no longer to make copies of sublists. This might seem like an optimization, but in this case an actual copy should be made. Copying sublists is useful because it makes a copy of a portion of the backing list, which can then be garbage collected. Making a copy also allows the result to be serializable, whereas in general sublists are not serializable. This last is actually a conformance issue, since List.copyOf() requires the result to be serializable.

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                smarks Stuart Marks
                Reporter:
                smarks Stuart Marks
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: