This is the first step in fly-weight statements. As described in YANGTOOLS-1067, we want to reuse List<EffectiveStatement> instances if they do not change during the copy operation.
This is mostly yang-parser-reactor work, but also requires exposing access to AbstractStatementSupport.createEffective(Current, List).
This should prove effective in this test case:
module foo { namespace foo; prefix foo; grouping grp { container foo { description "desc"; reference "ref"; } } uses foo; }
while /grp/foo and /foo are distinct objects, their EffectiveStatement.effectiveSubstatements() need to return the same object.