The issue was the following:
In the end, you end up with an immutable set of an immutable of an immutable set... of the original set. After a certain period of time, you have so many immutable wrappers than just calling isEmpty() causes a stack overflow. It only happens with Maps because CollectionHelper#toImmutableSet() has special cases if the map is empty or has only one element. You can reproduce it by validating what Gunnar presented above a few times and check what is in the cache. The elements in the cache should be wrapped only once, even after a few rounds of validation. |