Clarify NamespaceStorageSupport.getParentNamespaceStorage() 95/93495/1
authorRobert Varga <robert.varga@pantheon.tech>
Fri, 30 Oct 2020 09:08:51 +0000 (10:08 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Fri, 30 Oct 2020 11:29:46 +0000 (12:29 +0100)
This override does seemingly nothing, but in fact splits invocation
groups to two -- those going to SourceSpecificContext and those
going to a NamespaceStorageSupport subclass. More specifically, if
a caller knows it is talking to NamespaceStorageSupport, JIT does
will not consider SourceSpecificContext an implementation.

Furthermore, SourceSpecificContext, as an implementation class,
guarantees it will return BuildGlobalContext.

Change-Id: Ia285f9d7745a9c114d3dd3214c2b82a651db3ce0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 23fa427731dafe9db484f48bcdfe28ba20b5fd32)

yang/yang-parser-reactor/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/NamespaceStorageSupport.java
yang/yang-parser-reactor/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/SourceSpecificContext.java

index eb6dd6a3209412310b949cc5ecf22a57577dcb22..ddf97aa68da1a64183e01668a7f4819584425445 100644 (file)
@@ -26,6 +26,14 @@ abstract class NamespaceStorageSupport implements NamespaceStorageNode {
 
     private Map<Class<?>, Map<?,?>> namespaces = ImmutableMap.of();
 
+    /**
+     * {@inheritDoc}
+     *
+     * <p>
+     * This method override provides bimorphic invocation on this method invocation between
+     * {@link SourceSpecificContext} and the more general {@link NamespaceStorageSupport}. We typically do not expect
+     * the two accesses to overlap.
+     */
     @Override
     public abstract NamespaceStorageNode getParentNamespaceStorage();
 
index 324e4a83f6d9f083c6d8c4e05703d3ba743641ca..6cb76ffa4ea42f4d0e5b4e1a3b99b757f1f1f9b0 100644 (file)
@@ -277,7 +277,7 @@ public class SourceSpecificContext implements NamespaceStorageNode, NamespaceBeh
     }
 
     @Override
-    public NamespaceStorageNode getParentNamespaceStorage() {
+    public BuildGlobalContext getParentNamespaceStorage() {
         return currentContext;
     }