We should not be losing A/D/E type capture, but rather propagate it.
Change-Id: I6254a4f0ef0fea5b79815e99d1e6b03d33f679e4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
}
@SuppressWarnings("unchecked")
- final Mutable<QName, Y, Z> ret = (Mutable<QName, Y, Z>) copySubstatement((Mutable<?, ?, ?>) template)
- .orElseThrow(
- () -> new InferenceException(this, "Failed to materialize child %s template %s", qname, template));
+ final var ret = (Mutable<QName, Y, Z>) copySubstatement(template).orElseThrow(
+ () -> new InferenceException(this, "Failed to materialize child %s template %s", qname, template));
addMaterialized(template, ensureCompletedPhase(ret));
LOG.debug("Child {} materialized", qname);
}
}
- private Optional<? extends Mutable<?, ?, ?>> copySubstatement(final Mutable<?, ?, ?> substatement) {
+ private <X, Y extends DeclaredStatement<X>, Z extends EffectiveStatement<X, Y>> Optional<Mutable<X, Y, Z>>
+ copySubstatement(final StmtContext<X, Y, Z> substatement) {
return substatement.copyAsChildOf(this, childCopyType(), targetModule);
}
}
@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
- public final Optional<? extends Mutable<?, ?, ?>> copyAsChildOf(final Mutable<?, ?, ?> parent, final CopyType type,
+ public final Optional<Mutable<A, D, E>> copyAsChildOf(final Mutable<?, ?, ?> parent, final CopyType type,
final QNameModule targetModule) {
checkEffectiveModelCompleted(this);
return Optional.ofNullable(copyAsChildOfImpl(parent, type, targetModule));
@NonNull Mutable<A, D, E> replicaAsChildOf(Mutable<?, ?, ?> parent);
@Beta
- @NonNull Optional<? extends Mutable<?, ?, ?>> copyAsChildOf(Mutable<?, ?, ?> parent, CopyType type,
+ @NonNull Optional<Mutable<A, D, E>> copyAsChildOf(Mutable<?, ?, ?> parent, CopyType type,
@Nullable QNameModule targetModule);
ModelProcessingPhase getCompletedPhase();