Remove deprecated DataSchemaContextNode elements 61/104461/3
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 21 Feb 2023 15:42:17 +0000 (16:42 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 21 Feb 2023 15:49:00 +0000 (16:49 +0100)
The protected constructor, theoretically allowing this class to be
extended has been deprecated for a few releases, as are two static
factory methods. Remove them to allow us to further consider the
hierarchy of this class.

JIRA: YANGTOOLS-1413
Change-Id: I5010aa90ed426bac65d3023e2c64e9e356991e3d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
data/yang-data-util/src/main/java/org/opendaylight/yangtools/yang/data/util/DataSchemaContextNode.java

index 562d012f49138ed5977f9162880f86e02ff182cd..38dc78ff8ec5c3ec6efd7f958da9f691f3bde52e 100644 (file)
@@ -36,11 +36,9 @@ import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.ContainerLike;
 import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
 import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.SchemaNode;
 import org.opendaylight.yangtools.yang.model.util.SchemaInferenceStack;
 
 /**
@@ -70,12 +68,6 @@ public abstract class DataSchemaContextNode<T extends PathArgument> extends Abst
         this.dataSchemaNode = schema;
     }
 
-    // FIXME: remove this constructor. Once we do, adjust 'enterChild' visibility to package-private
-    @Deprecated(forRemoval = true, since = "8.0.2")
-    protected DataSchemaContextNode(final T identifier, final SchemaNode schema) {
-        this(identifier, schema instanceof DataSchemaNode dataSchema ? dataSchema : null);
-    }
-
     /**
      * This node is a {@link NormalizedNode} intermediate, not represented in RFC7950 XML encoding. This is typically
      * one of
@@ -145,10 +137,6 @@ public abstract class DataSchemaContextNode<T extends PathArgument> extends Abst
         return enterChild(requireNonNull(child), requireNonNull(stack));
     }
 
-    // FIXME: make this method package-private once the protected constructor is gone
-    protected abstract @Nullable DataSchemaContextNode<?> enterChild(@NonNull QName child,
-        @NonNull SchemaInferenceStack stack);
-
     /**
      * Attempt to enter a child {@link DataSchemaContextNode} towards the {@link DataSchemaNode} child identified by
      * specified {@link PathArgument}, adjusting provided {@code stack} with inference steps corresponding to
@@ -165,8 +153,9 @@ public abstract class DataSchemaContextNode<T extends PathArgument> extends Abst
         return enterChild(requireNonNull(child), requireNonNull(stack));
     }
 
-    // FIXME: make this method package-private once the protected constructor is gone
-    protected abstract @Nullable DataSchemaContextNode<?> enterChild(@NonNull PathArgument child,
+    abstract @Nullable DataSchemaContextNode<?> enterChild(@NonNull QName child, @NonNull SchemaInferenceStack stack);
+
+    abstract @Nullable DataSchemaContextNode<?> enterChild(@NonNull PathArgument child,
         @NonNull SchemaInferenceStack stack);
 
     /**
@@ -302,17 +291,6 @@ public abstract class DataSchemaContextNode<T extends PathArgument> extends Abst
         return lenientOf(child);
     }
 
-    /**
-     * Get a {@link DataSchemaContextNode} for a particular {@link DataSchemaNode}.
-     *
-     * @param potential Backing DataSchemaNode
-     * @return A {@link DataSchemaContextNode}, or null if the input is {@code null} or of unhandled type
-     */
-    @Deprecated(forRemoval = true, since = "8.0.2")
-    public static @Nullable DataSchemaContextNode<?> fromDataSchemaNode(final DataSchemaNode potential) {
-        return lenientOf(potential);
-    }
-
     private static @NonNull DataSchemaContextNode<?> fromListSchemaNode(final ListSchemaNode potential) {
         var keyDefinition = potential.getKeyDefinition();
         if (keyDefinition.isEmpty()) {
@@ -330,18 +308,4 @@ public abstract class DataSchemaContextNode<T extends PathArgument> extends Abst
         }
         return new UnorderedLeafListMixinContextNode(potential);
     }
-
-    /**
-     * Return a DataSchemaContextNode corresponding to specified {@link EffectiveModelContext}.
-     *
-     * @param ctx EffectiveModelContext
-     * @return A DataSchemaContextNode
-     * @throws NullPointerException if {@code ctx} is null
-     * @deprecated Use {@link DataSchemaContextTree#from(EffectiveModelContext)} and
-     *             {@link DataSchemaContextTree#getRoot()} instead.
-     */
-    @Deprecated(forRemoval = true, since = "8.0.2")
-    public static @NonNull DataSchemaContextNode<?> from(final EffectiveModelContext ctx) {
-        return new ContainerContextNode(ctx);
-    }
 }