From 76943f2ec79511177e9fddc4c2f4a888ccfb0b09 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Tue, 16 Feb 2021 16:15:34 +0100 Subject: [PATCH] Un-deprecate CopyableNode, AddedByUsesAware These traits seem to provide a useful inference summary, related to DerivableSchemaNode. Un-deprecate them for now to reduce noise for valid uses which have no alternative. Also add FIXMEs to reconsider overall design of these interfaces, as better semantic integration allows for more consistent use. Change-Id: I3d238f9c6f8d74769506202777efb82277546e63 Signed-off-by: Robert Varga --- .../yangtools/yang/model/api/AddedByUsesAware.java | 8 ++++---- .../yangtools/yang/model/api/CopyableNode.java | 9 +++------ .../yangtools/yang/model/api/DerivableSchemaNode.java | 8 +++----- .../yang/model/spi/meta/EffectiveStatementMixins.java | 2 -- .../yangtools/yang/parser/spi/meta/CopyHistory.java | 2 -- 5 files changed, 10 insertions(+), 19 deletions(-) diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/AddedByUsesAware.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/AddedByUsesAware.java index 94a91bdce7..d7e43c49b9 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/AddedByUsesAware.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/AddedByUsesAware.java @@ -7,13 +7,13 @@ */ package org.opendaylight.yangtools.yang.model.api; +import com.google.common.annotations.Beta; + /** * Trait interface for {@link SchemaNode}s, which have the {@link #isAddedByUses()} method. - * - * @deprecated This interface relates to declared model rather than to effective mode and as such should not - * exist. It is provided to provide common method definition and eash migration of users. */ -@Deprecated +@Beta +//FIXME: 8.0.0: refactor this interface to take into account DerivableSchemaNode public interface AddedByUsesAware { /** * Returns true if this node was added by uses statement, diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/CopyableNode.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/CopyableNode.java index b7f38a8426..34c92e7397 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/CopyableNode.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/CopyableNode.java @@ -7,16 +7,13 @@ */ package org.opendaylight.yangtools.yang.model.api; -import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement; +import com.google.common.annotations.Beta; /** * Represents a node that can be added by uses or by augmentation. - * - * @deprecated Aside from the deprecated {@link AddedByUsesAware} contract, this interface adds only a trait related - * to now how we arrived at this effective node. Users who need to know this information should really be - * looking at the {@link DeclaredStatement} world, which holds the original node definition. */ -@Deprecated +@Beta +// FIXME: 8.0.0: refactor this interface to take into account DerivableSchemaNode public interface CopyableNode extends AddedByUsesAware { /** * Returns true if this node was added by augmentation, diff --git a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/DerivableSchemaNode.java b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/DerivableSchemaNode.java index 2aaa58f1b2..7dd80983ad 100644 --- a/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/DerivableSchemaNode.java +++ b/yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/DerivableSchemaNode.java @@ -10,12 +10,10 @@ package org.opendaylight.yangtools.yang.model.api; import java.util.Optional; /** - * Schema Node which may be derived from other schema node - * using augmentation or uses statement. - * + * Schema Node which may be derived from other schema node using augmentation or uses statement. */ +// FIXME: 8.0.0: refactor this interface to take into account CopyableNode and AddedByUsesAware public interface DerivableSchemaNode extends DataSchemaNode { - /** * If this node is added by uses, returns original node definition from * grouping where it was defined. @@ -23,6 +21,6 @@ public interface DerivableSchemaNode extends DataSchemaNode { * @return original node definition from grouping if this node is added by * uses, Optional.absent otherwise */ + // FIXME: 8.0.0: this should be a type capture as it always matches this node's type Optional getOriginal(); - } diff --git a/yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/meta/EffectiveStatementMixins.java b/yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/meta/EffectiveStatementMixins.java index ad6b2cf63a..383d15ef0e 100644 --- a/yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/meta/EffectiveStatementMixins.java +++ b/yang/yang-model-spi/src/main/java/org/opendaylight/yangtools/yang/model/spi/meta/EffectiveStatementMixins.java @@ -101,7 +101,6 @@ public final class EffectiveStatementMixins { public interface AddedByUsesMixin> extends EffectiveStatementWithFlags, AddedByUsesAware { @Override - @Deprecated default boolean isAddedByUses() { return (flags() & FlagsBuilder.ADDED_BY_USES) != 0; } @@ -156,7 +155,6 @@ public final class EffectiveStatementMixins { */ public interface CopyableMixin> extends AddedByUsesMixin, CopyableNode { @Override - @Deprecated default boolean isAugmenting() { return (flags() & FlagsBuilder.AUGMENTING) != 0; } diff --git a/yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/CopyHistory.java b/yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/CopyHistory.java index 8c40867157..8b4e5846b5 100644 --- a/yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/CopyHistory.java +++ b/yang/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/CopyHistory.java @@ -93,13 +93,11 @@ public final class CopyHistory implements Immutable, CopyableNode { } @Override - @Deprecated public boolean isAugmenting() { return (operations & IS_AUGMENTING_BITS) != 0; } @Override - @Deprecated public boolean isAddedByUses() { return (operations & IS_ADDED_BY_USES_BITS) != 0; } -- 2.36.6