[concurrency-interest] NavigableMap implementation bugs
dl at cs.oswego.edu
Mon Jun 9 12:02:48 PDT 2008
Martin Buchholz wrote:
> fails because TreeMap.KeySet.subset calls the
Thanks for finding this!
> In the case of ConcurrentSkipListMap, the correctness
> issue is even more serious, since remove(existing element)
> fails to remove it.
> It's not obvious how to best fix it. The TreeSet(NavigableMap)
> and ConcurrentSkipListMap(NavigableMap) constructors
> simply cannot be used to get views of non-empty maps.
> It's clear that the usual straightforward but tedious solution
> will work, but is there an elegant solution?
I don't think so. Relaying the subset methods to the *Set classes
was just an implementation expediency under the mis-thought that they
would take care of recursive subsets etc rather than needing
special implementations for KeySets. But the byproduct for remove()
is clearly wrong so they do need separate implementations.
More information about the core-libs-dev