Extract AbstractResumedStatement
[yangtools.git] / yang / yang-parser-reactor / src / main / java / org / opendaylight / yangtools / yang / parser / stmt / reactor / SourceSpecificContext.java
index f11a094ed7dea2af79d7e99c80d2bab6367c71a7..f1d2652a26b0c8fcfca2d31539e45109505e39fa 100644 (file)
@@ -101,14 +101,14 @@ public class SourceSpecificContext implements NamespaceStorageNode, NamespaceBeh
         return inProgressPhase;
     }
 
-    Optional<StatementContextBase<?, ?, ?>> lookupDeclaredChild(final StatementContextBase<?, ?, ?> current,
+    Optional<AbstractResumedStatement<?, ?, ?>> lookupDeclaredChild(final AbstractResumedStatement<?, ?, ?> current,
             final int childId) {
         if (current == null) {
             return Optional.empty();
         }
 
         // Fast path: we are entering a statement which was emitted in previous phase
-        StatementContextBase<?, ?, ?> existing = current.lookupSubstatement(childId);
+        AbstractResumedStatement<?, ?, ?> existing = current.lookupSubstatement(childId);
         while (existing != null && StatementSource.CONTEXT == existing.getStatementSource()) {
             existing = existing.lookupSubstatement(childId);
         }
@@ -116,8 +116,8 @@ public class SourceSpecificContext implements NamespaceStorageNode, NamespaceBeh
         return Optional.ofNullable(existing);
     }
 
-    StatementContextBase<?, ?, ?> createDeclaredChild(final StatementContextBase<?, ?, ?> current, final int childId,
-            final QName name, final String argument, final StatementSourceReference ref) {
+    AbstractResumedStatement<?, ?, ?> createDeclaredChild(final AbstractResumedStatement<?, ?, ?> current,
+            final int childId, final QName name, final String argument, final StatementSourceReference ref) {
         StatementDefinitionContext<?, ?, ?> def = currentContext.getStatementDefinition(getRootVersion(), name);
         if (def == null) {
             def = currentContext.getModelDefinedStatementDefinition(name);
@@ -299,9 +299,8 @@ public class SourceSpecificContext implements NamespaceStorageNode, NamespaceBeh
         final Collection<ModifierImpl> currentPhaseModifiers = modifiers.get(phase);
 
         boolean hasProgressed = tryToProgress(currentPhaseModifiers);
-
-        checkNotNull(this.root, "Malformed source. Valid root element is missing.");
-        final boolean phaseCompleted = root.tryToCompletePhase(phase);
+        final boolean phaseCompleted = requireNonNull(root, "Malformed source. Valid root element is missing.")
+                .tryToCompletePhase(phase);
 
         hasProgressed |= tryToProgress(currentPhaseModifiers);
 
@@ -389,7 +388,7 @@ public class SourceSpecificContext implements NamespaceStorageNode, NamespaceBeh
     }
 
     private PrefixToModule preLinkagePrefixes() {
-        final PrefixToModuleMap preLinkagePrefixes = new PrefixToModuleMap(true);
+        final PrefixToModuleMap preLinkagePrefixes = new PrefixToModuleMap();
         final Map<String, URI> prefixToNamespaceMap = getAllFromLocalStorage(ImpPrefixToNamespace.class);
         if (prefixToNamespaceMap == null) {
             //:FIXME if it is a submodule without any import, the map is null. Handle also submodules and includes...