Clarify NamespaceStorageSupport.getParentNamespaceStorage() 81/93481/2
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 09:37:58 +0000 (10:37 +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>
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 f278afcd5673f24f528ae8f910d04b943c9c9567..7b717fbeec4794f6cace2584cb57eadd9e5af1ff 100644 (file)
@@ -274,7 +274,7 @@ final class SourceSpecificContext implements NamespaceStorageNode, NamespaceBeha
     }
 
     @Override
-    public NamespaceStorageNode getParentNamespaceStorage() {
+    public BuildGlobalContext getParentNamespaceStorage() {
         return globalContext;
     }