Eliminate StatementNamespace.TreeScoped 51/102151/2
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 18 Aug 2022 15:28:57 +0000 (17:28 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 18 Aug 2022 21:29:38 +0000 (23:29 +0200)
This subclass is not really useful, as it just mirrors
NamespaceBehaviour.treeScoped(). Remove it to flatten the type hierarchy
a bit.

JIRA: YANGTOOLS-1453
Change-Id: I651c8682c1198c766fc6ad512bf444e9df77b365
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
parser/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/ParserNamespaces.java
parser/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/StatementNamespace.java

index fe266db6e060a34412451b4b88296195b523b280..5df13187ddceb91237b6c1dbd5536e6ecb5e7bac 100644 (file)
@@ -28,7 +28,6 @@ import org.opendaylight.yangtools.yang.model.api.stmt.TypedefStatement;
 import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
 import org.opendaylight.yangtools.yang.parser.spi.meta.ParserNamespace;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StatementNamespace;
-import org.opendaylight.yangtools.yang.parser.spi.meta.StatementNamespace.TreeScoped;
 
 /**
  * Baseline {@link ParserNamespace}s mostly derived from YANG specification.
@@ -58,8 +57,8 @@ public final class ParserNamespaces {
      * <p>
      * This means that any descendant node may use that grouping, and it MUST NOT define a grouping with the same name.
      */
-    public static final @NonNull TreeScoped<QName, GroupingStatement, GroupingEffectiveStatement> GROUPING =
-        new TreeScoped<>("grouping");
+    public static final @NonNull StatementNamespace<QName, GroupingStatement, GroupingEffectiveStatement> GROUPING =
+        new StatementNamespace<>("grouping");
 
     /**
      * Identity namespace. All identity names defined in a module and its submodules share the same identity identifier
@@ -93,8 +92,8 @@ public final class ParserNamespaces {
      * This namespace includes all type definitions implied by the language in which the current statement resides
      * (e.g. RFC6020/RFC7950 for YANG 1.0/1.1).
      */
-    public static final @NonNull TreeScoped<QName, TypedefStatement, TypedefEffectiveStatement> TYPE =
-        new TreeScoped<>("typedef");
+    public static final @NonNull StatementNamespace<QName, TypedefStatement, TypedefEffectiveStatement> TYPE =
+        new StatementNamespace<>("typedef");
 
     /**
      * A derived namespace allowing lookup of modules based on their {@link QNameModule}.
index ed9fb9f9e0426a7b40e0136346aa92fe5e827c62..ff8e3f6b0896721a8521492b023304a1e05c7fe1 100644 (file)
@@ -21,15 +21,4 @@ public class StatementNamespace<K, D extends DeclaredStatement<?>, E extends Eff
     public StatementNamespace(final @NonNull String name) {
         super(name);
     }
-
-    // FIXME: is this subclass useful at all?
-    public static class TreeScoped<K, D extends DeclaredStatement<?>, E extends EffectiveStatement<?, D>>
-            extends StatementNamespace<K, D, E> {
-        @Serial
-        private static final long serialVersionUID = 1L;
-
-        public TreeScoped(final @NonNull String name) {
-            super(name);
-        }
-    }
 }