RFC: Adding ConcurrentModificationException for HashMap.computeIfAbsent(), and JDK-8071667
Ben Manes
ben_manes at yahoo.com
Fri Mar 6 23:58:35 UTC 2015
Nevermind, sorry somehow I missed the previous emails in the thread.
On Friday, March 6, 2015 3:57 PM, Ben Manes <ben_manes at yahoo.com> wrote:
I'd recommend that the exception thrown should be an IllegalStateException. This is documented in ConcurrentHashMap's computeIfAbsent as,
* @throws IllegalStateException if the computation detectably
* attempts a recursive update to this map that would
* otherwise never complete
The detection logic is in Doug's repository to be merged in for JDK-8062841.
It is also unexpected to have a concurrent data structure throw a ConcurrentModificationException, which is why I believe that IllegalStateException was chosen for ConcurrentHashMap.
More information about the core-libs-dev
mailing list