Fix `Spliterator` characteristics in `ConcurrentReferenceHashMap` by kilink · Pull Request #35817 · spring-projects/spring-framework
The Spliterators returned by values, entrySet, and keySet incorrectly reported the SIZED characteristic, instead of CONCURRENT. This could lead to bugs when the map is concurrently modified during a stream operation. For keySet and values, the incorrect characteristics are inherited from AbstractMap, so to rectify that the respective methods are overridden and custom collections are provided that report the correct Spliterator characteristics. Signed-off-by: Patrick Strawderman <pstrawderman@netflix.com>
label
Nov 15, 2025
sbrannen
changed the title
Fix Spliterator characteristics in ConcurrentReferenceHashMap
Fix Spliterator characteristics in ConcurrentReferenceHashMap
sbrannen pushed a commit that referenced this pull request
Nov 17, 2025The Spliterators returned by values, entrySet, and keySet incorrectly reported the SIZED characteristic, instead of CONCURRENT. This could lead to bugs when the map is concurrently modified during a stream operation. For keySet and values, the incorrect characteristics are inherited from AbstractMap, so to rectify that the respective methods are overridden, and custom collections are provided that report the correct Spliterator characteristics. Closes gh-35817 Signed-off-by: Patrick Strawderman <pstrawderman@netflix.com> (cherry picked from commit ed75906)
kilink
deleted the
concurrent-reference-hash-map-fix-spliterators
branch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters