RFR: 8351230: Collections.synchronizedList returns a list that is not thread-safe

Stuart Marks smarks at openjdk.org
Fri May 2 18:31:31 UTC 2025


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.

-------------

Commit messages:
 - moar comments
 - Various tweaks.
 - fix for synch list
 - fix copyright line
 - tests for synch list

Changes: https://git.openjdk.org/jdk/pull/24990/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=24990&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8351230
  Stats: 227 lines in 3 files changed: 214 ins; 9 del; 4 mod
  Patch: https://git.openjdk.org/jdk/pull/24990.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/24990/head:pull/24990

PR: https://git.openjdk.org/jdk/pull/24990


More information about the core-libs-dev mailing list