Refactor ExtensionStatementSupport
Using RecursiveObjectLeaker requires integration with object
construction and is inherently dangerous.
As it turns out, we can solve this problem differently, without
having to rely on this magic by pre-allocating the resulting
effective statement and populating it into a thread-local map.
That allows us to pick up that object for purposes of including
it in substatements -- thus breaking the recursion. Once we have
acquired substatements, the real build methods just fill them
into the pre-allocated object are return it.
On exit we check whether we have cleared the state map and clean
it up automatically, as this is not expected to be a major
performance problem.
JIRA: YANGTOOLS-1122
Change-Id: Iebbbffd6f62fa57ce496a2ab7bc8e5792198d3a5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>