import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour.StorageNodeType;
import org.opendaylight.yangtools.yang.parser.spi.meta.ParserNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.StatementFactory;
-import org.opendaylight.yangtools.yang.parser.spi.meta.StatementNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.StatementSupport;
import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
import org.opendaylight.yangtools.yang.parser.spi.source.StatementSourceReference;
extends ReactorStmtCtx<A, D, E> {
private final StatementContextBase<?, ?, ?> parent;
private final ReactorStmtCtx<A, D, E> source;
+ // We need to drop source's reference count when we are being swept.
+ private final boolean haveSourceRef;
ReplicaStatementContext(final StatementContextBase<?, ?, ?> parent, final ReactorStmtCtx<A, D, E> source) {
super(source, null);
this.source = requireNonNull(source);
if (source.isSupportedToBuildEffective()) {
source.incRef();
+ haveSourceRef = true;
+ } else {
+ haveSourceRef = false;
}
}
@Override
E createInferredEffective(final StatementFactory<A, D, E> factory, final InferredStatementContext<A, D, E> ctx,
- final Stream<? extends StmtContext<?, ?, ?>> declared,
- final Stream<? extends StmtContext<?, ?, ?>> effective) {
+ final Stream<? extends ReactorStmtCtx<?, ?, ?>> declared,
+ final Stream<? extends ReactorStmtCtx<?, ?, ?>> effective) {
return source.createInferredEffective(factory, ctx, declared, effective);
}
}
@Override
- public Optional<? extends Mutable<?, ?, ?>> copyAsChildOf(final Mutable<?, ?, ?> newParent, final CopyType type,
+ public Optional<Mutable<A, D, E>> copyAsChildOf(final Mutable<?, ?, ?> newParent, final CopyType type,
final QNameModule targetModule) {
return source.copyAsChildOf(newParent, type, targetModule);
}
@Override
int sweepSubstatements() {
- if (haveSourceReference()) {
+ if (haveSourceRef) {
source.decRef();
}
return 0;
@Override
@Deprecated
- public <K, KT extends K, Y extends DeclaredStatement<?>, Z extends EffectiveStatement<?, Y>> void addContext(
- final StatementNamespace<K, Y, Z> namespace, final KT key, final StmtContext<?, Y, Z> stmt) {
+ public <K, KT extends K, C extends StmtContext<?, ?, ?>> void addContext(
+ final ParserNamespace<K, ? super C> namespace, final KT key, final C stmt) {
throw new UnsupportedOperationException();
}