RFR: 8351230: Collections.synchronizedList returns a list that is not thread-safe [v2]
Jaikiran Pai
jpai at openjdk.org
Fri May 16 09:26:57 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.
test/jdk/java/util/Collections/SyncListBash.java line 31:
> 29: * @run main SyncListBash f
> 30: * @run main SyncListBash r
> 31: * @summary Test that List's new SequencedCollection methods are properly
Nit - jtreg recommends `@summary` to be after `@bug` https://openjdk.org/jtreg/tag-spec.html#ORDER. It would be good to follow that for this new test.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24990#discussion_r2092688878
More information about the core-libs-dev
mailing list