Consider using the [`IdentityHashMap`](http://docs.oracle.com/javase/7/docs/api/java/util/IdentityHashMap.html) to avoid rare, infinite cycles (probably none in ES codebase for now, but you never know with plugins).