import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContextUtils;
import org.opendaylight.yangtools.yang.parser.stmt.reactor.StatementContextBase;
+import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.RecursiveObjectLeaker;
public abstract class EffectiveStatementBase<A, D extends DeclaredStatement<A>> implements EffectiveStatement<A, D> {
private final List<? extends EffectiveStatement<?, ?>> substatements;
* context of statement.
*/
protected EffectiveStatementBase(final StmtContext<A, D, ?> ctx) {
-
final Collection<StatementContextBase<?, ?, ?>> effectiveSubstatements = ctx.effectiveSubstatements();
final Collection<StatementContextBase<?, ?, ?>> substatementsInit = new ArrayList<>();
}
substatementsInit.addAll(effectiveSubstatements);
+ // WARNING: this leaks an incompletely-initialized pbject
+ RecursiveObjectLeaker.inConstructor(this);
+
this.substatements = ImmutableList.copyOf(Collections2.transform(Collections2.filter(substatementsInit,
StmtContext::isSupportedToBuildEffective), StatementContextBase::buildEffective));
}