RFR: 8351230: Collections.synchronizedList returns a list that is not thread-safe [v2]
Jaikiran Pai
jpai at openjdk.org
Fri May 16 09:37:56 UTC 2025
On Mon, 5 May 2025 23:36:35 GMT, Stuart Marks <smarks at openjdk.org> wrote:
>> Collections.synchronizedList() returns a List implementation that doesn't do proper locking. This PR does the following on the synchronized wrapper:
>>
>> - overrides and adds locking to SequencedCollection methods;
>> - performs instance management of reversed synchronized views;
>> - adds test for race conditions and functional tests of synchronized wrappers.
>
> Stuart Marks has updated the pull request incrementally with one additional commit since the last revision:
>
> Reversed view of SynchronizedRandomAccessList should also be RandomAccess.
> Add tests to ensure RandomAccess is preserved when reversing.
The fix and tests look good to me. I just have a nit that I've included as a review comment for the new test.
-------------
Marked as reviewed by jpai (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/24990#pullrequestreview-2846098206
More information about the core-libs-dev
mailing list