From 33129f14b5a86c0b702b1a90eb22b6ba61bed287 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Sat, 16 Oct 2021 11:13:04 +0200 Subject: [PATCH] Add more deprecations around SchemaPath We have a few constructs which provide bridging to SchemaPath, which are now triggering warnings. Deprecate them, so that we suppress warnings and give users some time to adjust. Change-Id: I4cdfd47cceacceca27e6a155a87999c97ea7a490 Signed-off-by: Robert Varga --- .../yangtools/yang/model/api/PathFromRoot.java | 1 + .../yang/model/api/stmt/SchemaNodeIdentifier.java | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/model/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/PathFromRoot.java b/model/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/PathFromRoot.java index ca30dd03ba..7b70b1743d 100644 --- a/model/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/PathFromRoot.java +++ b/model/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/PathFromRoot.java @@ -22,6 +22,7 @@ import org.eclipse.jdt.annotation.Nullable; import org.opendaylight.yangtools.concepts.Immutable; import org.opendaylight.yangtools.yang.common.QName; +@Deprecated(since = "7.0.9", forRemoval = true) final class PathFromRoot extends AbstractList implements Immutable { private static final QName[] EMPTY_QNAMES = new QName[0]; private static final VarHandle QNAMES; diff --git a/model/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/SchemaNodeIdentifier.java b/model/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/SchemaNodeIdentifier.java index dd4c0cb624..029d963af1 100644 --- a/model/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/SchemaNodeIdentifier.java +++ b/model/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/SchemaNodeIdentifier.java @@ -87,6 +87,7 @@ public abstract class SchemaNodeIdentifier implements Immutable { } @Override + @Deprecated(since = "7.0.9", forRemoval = true) final SchemaPath implicitSchemaPathParent() { return SchemaPath.ROOT; } @@ -142,6 +143,7 @@ public abstract class SchemaNodeIdentifier implements Immutable { } @Override + @Deprecated(since = "7.0.9", forRemoval = true) final SchemaPath implicitSchemaPathParent() { return SchemaPath.SAME; } @@ -244,10 +246,12 @@ public abstract class SchemaNodeIdentifier implements Immutable { } } + @Deprecated(since = "7.0.9", forRemoval = true) private static final AtomicReferenceFieldUpdater SCHEMAPATH_UPDATER = AtomicReferenceFieldUpdater.newUpdater(SchemaNodeIdentifier.class, SchemaPath.class, "schemaPath"); // Cached SchemaPath. + @Deprecated(since = "7.0.9", forRemoval = true) private volatile SchemaPath schemaPath; // Cached hashCode private volatile int hash; @@ -288,7 +292,9 @@ public abstract class SchemaNodeIdentifier implements Immutable { * Create the {@link SchemaPath} equivalent of this identifier. * * @return SchemaPath equivalent. + * @deprecated This method is scheduled for removal along with {@link SchemaPath}. */ + @Deprecated(since = "7.0.9", forRemoval = true) public final @NonNull SchemaPath asSchemaPath() { final SchemaPath ret = schemaPath; return ret != null ? ret : loadSchemaPath(); @@ -311,12 +317,14 @@ public abstract class SchemaNodeIdentifier implements Immutable { return MoreObjects.toStringHelper(className()).add("qnames", toStringQNames()).toString(); } + @Deprecated(since = "7.0.9", forRemoval = true) abstract @NonNull SchemaPath implicitSchemaPathParent(); abstract @NonNull Object pathObject(); abstract @NonNull String className(); + @Deprecated(since = "7.0.9", forRemoval = true) private @NonNull SchemaPath loadSchemaPath() { final SchemaPath newPath = implicitSchemaPathParent().createChild(getNodeIdentifiers()); return SCHEMAPATH_UPDATER.compareAndSet(this, null, newPath) ? newPath : schemaPath; -- 2.36.6