BUG-1790: detect existing unmodifiableMap encapsulation
Commit
9bcc82d107075da35c8cd01422481eaea395ba29 introduced a way to
reuse children map by builders. Unfortunately there is a codepath which
could see us receiving the returned collection in our constructor, and
the subsequent operation would wrap it again. If you stack these
operations, at some point the nesting becomes unmanageable.
The fix is to detect a previously-encapsulated collection and reusing
it. Analysis also shows that the children field is not needed, so remove
it as well.
Change-Id: I42d604d290326afca4564565760cbcf4586c2908
Signed-off-by: Robert Varga <rovarga@cisco.com>