On Fri, 20 Feb 2026 15:05:18 GMT, Jaikiran Pai <[email protected]> wrote:
> > We should create an issue in JBS for this. > > I've now filed https://bugs.openjdk.org/browse/JDK-8378354. > > @cdw200806, please update the title of this PR to `8378354: Faulty assertion > in checkInvariants method of ConcurrentHashMap` to initiate an official > review of this change. Please also merge the latest changes from master > branch into this PR. @jaikiran @DougLea @AlanBateman @liach Hi Colleagues in JDK, I also have another findings, but it is hard to fix. So I just mention here, please check. If you decide to raise a ticket to me, please share the ticket number to me, thanks. Run this 4 line code in a main() method, JDK will throw StackOverflowError caused by recursion. Before throw err, the console print "{(this Map)=Some String}" ConcurrentHashMap map = new ConcurrentHashMap(); map.put(map, "Some String"); System.out.println(map); map.put(map, "Some String"); The toString() method of ConcurrentHashMap seems to fixed this issue by replace this map to "(this Map)" . But for hashCode() method of ConcurrentHashMap, it seems has not consider the recursion case. Why hard to fix: consider this case, the key has recursion it self, it will throw StackOverflowError too. ConcurrentHashMap map = new ConcurrentHashMap(); Map map2 = new HashMap(); map2.put(map2, "Some String"); map.put(map2, "Some String"); ------------- PR Comment: https://git.openjdk.org/jdk/pull/24612#issuecomment-3936476482
