Remove YangModuleInfo when it is unregistered
This patch addresses a FIXME, which was left in the code base
and thus makes sure we do not retain stale class loaders from
explicit registrations.
Unfortunately the design of this class mixes quite a few aspects:
- the ability to build SchemaContext
- the ability to explicitly register YangModuleInfos (with their
dependencies)
- the ability to implicitly register YangModuleInfos through
ClassLoadingStrategy.loadClass() failure path
- the ability to create an instance with pre-populated set of entries
used only for testing/static purposes
The interplay between these aspects is ill-defined, especially
items 2 and 3, hence fixing the issue in most correct way possible
requires redesigning internal state tracking, explicitly
differentiating between the two cases.
JIRA: MDSAL-461
Change-Id: I8f99d3975e971e32b267788a463d9b73bb57e49e
Signed-off-by: Jie Han <han.jie@zte.com.cn>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>