RFR: 8351230: Collections.synchronizedList returns a list that is not thread-safe
Luca Kellermann
duke at openjdk.org
Sun May 4 17:55:46 UTC 2025
On Thu, 1 May 2025 19:05:50 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.
src/java.base/share/classes/java/util/Collections.java line 2837:
> 2835: return reversedView;
> 2836: }
> 2837: }
`SynchronizedRandomAccessList` overrides `subList`, should it also override `reversed`?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24990#discussion_r2072672563
More information about the core-libs-dev
mailing list