import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedHashMap;
import org.opendaylight.yangtools.yang.parser.spi.GroupingNamespace;
import org.opendaylight.yangtools.yang.parser.spi.SchemaTreeNamespace;
import org.opendaylight.yangtools.yang.parser.spi.meta.AbstractQNameStatementSupport;
+import org.opendaylight.yangtools.yang.parser.spi.meta.BoundStmtCtx;
import org.opendaylight.yangtools.yang.parser.spi.meta.CopyType;
import org.opendaylight.yangtools.yang.parser.spi.meta.EffectiveStmtCtx.Current;
import org.opendaylight.yangtools.yang.parser.spi.meta.InferenceException;
}
@Override
- protected UsesStatement createDeclared(final StmtContext<QName, UsesStatement, ?> ctx,
- final ImmutableList<? extends DeclaredStatement<?>> substatements) {
+ protected UsesStatement createDeclared(final BoundStmtCtx<QName> ctx,
+ final ImmutableList<DeclaredStatement<?>> substatements) {
return DeclaredStatements.createUses(ctx.getRawArgument(), ctx.getArgument(), substatements);
}
* @throws SourceException
* instance of SourceException
*/
- @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
- justification = "https://github.com/spotbugs/spotbugs/issues/811")
private static void copyFromSourceToTarget(final StmtContext<?, ?, ?> sourceGrpStmtCtx,
final Mutable<?, ?, ?> targetCtx, final Mutable<QName, UsesStatement, UsesEffectiveStatement> usesNode) {
final var declared = sourceGrpStmtCtx.declaredSubstatements();
final QNameModule newQNameModule = getNewQNameModule(targetCtx, sourceGrpStmtCtx);
for (StmtContext<?, ?, ?> original : declared) {
- if (original.isSupportedByFeatures() && shouldCopy(original)) {
- original.copyAsChildOf(targetCtx, CopyType.ADDED_BY_USES, newQNameModule).ifPresent(buffer::add);
+ if (shouldCopy(original)) {
+ original.copyAsChildOf(targetCtx, CopyType.ADDED_BY_USES, newQNameModule).ifPresent(copy -> {
+ if (!original.isSupportedByFeatures() || !original.isSupportedToBuildEffective()) {
+ copy.setUnsupported();
+ }
+ buffer.add(copy);
+ });
}
}
return null;
}
- @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
- justification = "https://github.com/spotbugs/spotbugs/issues/811")
private static void resolveUsesNode(final Mutable<QName, UsesStatement, UsesEffectiveStatement> usesNode,
final StmtContext<?, ?, ?> targetNodeStmtCtx) {
for (Mutable<?, ?, ?> subStmtCtx : usesNode.mutableDeclaredSubstatements()) {