Another round of checkstyle fixes 97/63197/1
authorRobert Varga <robert.varga@pantheon.tech>
Sun, 17 Sep 2017 08:03:45 +0000 (10:03 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Sun, 17 Sep 2017 08:04:19 +0000 (10:04 +0200)
Brings down the number of violations to under 700.

Change-Id: I8da94e59b13fa109832b6d903045c352ad47786c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
31 files changed:
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/repo/AbstractYangTextSchemaSourceRegistration.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/repo/DependencyResolver.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/repo/SemVerDependencyResolver.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/repo/SharedSchemaContextFactory.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/repo/SharedSchemaRepository.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/repo/YangTextSchemaContextResolver.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/rfc6020/repo/StatementSourceReferenceHandler.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/BuildGlobalContext.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/CrossSourceStatementReactor.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/EffectiveSchemaContext.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/ModifierImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/NamespaceBehaviourWithListeners.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/NamespaceStorageSupport.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/RootStatementContext.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/SourceSpecificContext.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/StatementContextBase.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/StatementDefinitionContext.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/StatementMap.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/SubstatementContext.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc7950/ActionStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc7950/AnydataStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc7950/ModifierStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc7950/NotificationStatementRfc7950Support.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc7950/TypeStatementRfc7950Support.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc7950/effective/ActionEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc8040/YangDataEffectiveStatement.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc8040/YangDataStatement.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/util/ASTSchemaSource.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/util/ModuleDependencySort.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/util/TextToASTTransformer.java
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/ConstraintDefinitionsTest.java

index db3569ddd35ea38eb2e90ad0935438022b5dbb28..bbab150bfe64f69beda72c52aac1d131c041c30e 100644 (file)
@@ -10,7 +10,8 @@ package org.opendaylight.yangtools.yang.parser.repo;
 import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
 import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
 
-public abstract class AbstractYangTextSchemaSourceRegistration extends AbstractObjectRegistration<YangTextSchemaSource> implements YangTextSchemaSourceRegistration {
+public abstract class AbstractYangTextSchemaSourceRegistration extends AbstractObjectRegistration<YangTextSchemaSource>
+        implements YangTextSchemaSourceRegistration {
     protected AbstractYangTextSchemaSourceRegistration(final YangTextSchemaSource instance) {
         super(instance);
     }
index bc339f7f54932488dc77211a9372424a1376a370..16ba9878bbe41df9ac7690e25243c235196beb58 100644 (file)
@@ -32,11 +32,10 @@ import org.slf4j.LoggerFactory;
  * corresponding dependency information, the {@link #create(Map)} method creates a
  * a view of how consistent the dependencies are. In particular, this detects whether
  * any imports are unsatisfied.
- *
- * FIXME: improve this class to track and expose how wildcard imports were resolved.
- *        That information will allow us to track "damage" to dependency resolution
- *        as new models are added to a schema context.
  */
+// FIXME: improve this class to track and expose how wildcard imports were resolved.
+//        That information will allow us to track "damage" to dependency resolution
+//        as new models are added to a schema context.
 abstract class DependencyResolver {
     private static final Logger LOG = LoggerFactory.getLogger(DependencyResolver.class);
     private final Collection<SourceIdentifier> resolvedSources;
@@ -110,12 +109,10 @@ abstract class DependencyResolver {
         this.unsatisfiedImports = ImmutableMultimap.copyOf(imports);
     }
 
-    abstract protected boolean isKnown(final Collection<SourceIdentifier> haystack, final ModuleImport mi);
+    protected abstract boolean isKnown(Collection<SourceIdentifier> haystack, ModuleImport mi);
 
     /**
      * Collection of sources which have been resolved.
-     *
-     * @return
      */
     Collection<SourceIdentifier> getResolvedSources() {
         return resolvedSources;
@@ -123,8 +120,6 @@ abstract class DependencyResolver {
 
     /**
      * Collection of sources which have not been resolved due to missing dependencies.
-     *
-     * @return
      */
     Collection<SourceIdentifier> getUnresolvedSources() {
         return unresolvedSources;
@@ -135,18 +130,19 @@ abstract class DependencyResolver {
      * is the source identifier of module which was issuing an import, the values
      * are imports which were unsatisfied.
      *
+     * <p>
      * Note that this map contains only imports which are missing from the reactor,
      * not transitive failures.
      *
+     * <p>
      * Examples:
-     *
+     * <ul><li>
      * If A imports B, B imports C, and both A and B are in the reactor, only B->C
      * will be reported.
-     *
+     * </li><li>
      * If A imports B and C, B imports C, and both A and B are in the reactor,
      * A->C and B->C will be reported.
-     *
-     * @return
+     * </li></ul>
      */
     Multimap<SourceIdentifier, ModuleImport> getUnsatisfiedImports() {
         return unsatisfiedImports;
@@ -155,7 +151,7 @@ abstract class DependencyResolver {
     private static class BelongsToDependency implements ModuleImport {
         private final String parent;
 
-        public BelongsToDependency(final String parent) {
+        BelongsToDependency(final String parent) {
             this.parent = parent;
         }
 
index 8567254762b5df868e44f4a13db1e4e07cd71e6e..b7174fa5b14ad5bed17f543cc56f17ff69072ce8 100644 (file)
@@ -23,7 +23,8 @@ final class SemVerDependencyResolver extends DependencyResolver {
         super(depInfo);
     }
 
-    protected static SourceIdentifier findCompatibleVersion(final Iterable<SourceIdentifier> haystack, final ModuleImport mi) {
+    protected static SourceIdentifier findCompatibleVersion(final Iterable<SourceIdentifier> haystack,
+            final ModuleImport mi) {
         final String requestedModuleName = mi.getModuleName();
         for (SourceIdentifier r : haystack) {
             if (requestedModuleName.equals(r.getName())
@@ -42,7 +43,8 @@ final class SemVerDependencyResolver extends DependencyResolver {
     @Override
     protected boolean isKnown(final Collection<SourceIdentifier> haystack, final ModuleImport mi) {
         final String rev = mi.getRevision() != null ? QName.formattedRevision(mi.getRevision()) : null;
-        final SemVerSourceIdentifier msi = SemVerSourceIdentifier.create(mi.getModuleName(), Optional.fromNullable(rev), mi.getSemanticVersion());
+        final SemVerSourceIdentifier msi = SemVerSourceIdentifier.create(mi.getModuleName(), Optional.fromNullable(rev),
+            mi.getSemanticVersion());
 
         // Quick lookup
         if (haystack.contains(msi)) {
@@ -56,4 +58,4 @@ final class SemVerDependencyResolver extends DependencyResolver {
     public static SemVerDependencyResolver create(final Map<SourceIdentifier, YangModelDependencyInfo> depInfo) {
         return new SemVerDependencyResolver(depInfo);
     }
-}
\ No newline at end of file
+}
index 0288d7afec7ca1dbaae98c0c30087e6391f1396b..ce9ed357762ef57ca0b8e83aade54f6e3a2f0bc2 100644 (file)
@@ -65,7 +65,7 @@ final class SharedSchemaContextFactory implements SchemaContextFactory {
 
     // FIXME SchemaRepository should be the type for repository parameter instead of SharedSchemaRepository
     //       (final implementation)
-    public SharedSchemaContextFactory(final SharedSchemaRepository repository, final SchemaSourceFilter filter) {
+    SharedSchemaContextFactory(final SharedSchemaRepository repository, final SchemaSourceFilter filter) {
         this.repository = Preconditions.checkNotNull(repository);
         this.filter = Preconditions.checkNotNull(filter);
     }
@@ -79,10 +79,6 @@ final class SharedSchemaContextFactory implements SchemaContextFactory {
                 new AssembleSources(Optional.ofNullable(supportedFeatures), statementParserMode));
     }
 
-    private ListenableFuture<ASTSchemaSource> requestSource(final SourceIdentifier identifier) {
-        return repository.getSchemaSource(identifier, ASTSchemaSource.class);
-    }
-
     private CheckedFuture<SchemaContext, SchemaResolutionException> createSchemaContext(
             final Collection<SourceIdentifier> requiredSources,
             final Cache<Collection<SourceIdentifier>, SchemaContext> cache,
@@ -118,15 +114,21 @@ final class SharedSchemaContextFactory implements SchemaContextFactory {
             }
 
             @Override
-            public void onFailure(@Nonnull final Throwable t) {
-                LOG.debug("Failed to assemble sources", t);
+            public void onFailure(@Nonnull final Throwable cause) {
+                LOG.debug("Failed to assemble sources", cause);
             }
         }, MoreExecutors.directExecutor());
 
         return Futures.makeChecked(cf, MAPPER);
     }
 
+    private ListenableFuture<ASTSchemaSource> requestSource(final SourceIdentifier identifier) {
+        return repository.getSchemaSource(identifier, ASTSchemaSource.class);
+    }
+
     /**
+     * Return a set of de-duplicated inputs.
+     *
      * @return set (preserving ordering) from the input collection
      */
     private static List<SourceIdentifier> deDuplicateSources(final Collection<SourceIdentifier> requiredSources) {
@@ -145,7 +147,7 @@ final class SharedSchemaContextFactory implements SchemaContextFactory {
             List<ASTSchemaSource>> {
         private final List<SourceIdentifier> sourceIdentifiers;
 
-        public SourceIdMismatchDetector(final List<SourceIdentifier> sourceIdentifiers) {
+        SourceIdMismatchDetector(final List<SourceIdentifier> sourceIdentifiers) {
             this.sourceIdentifiers = Preconditions.checkNotNull(sourceIdentifiers);
         }
 
@@ -186,11 +188,11 @@ final class SharedSchemaContextFactory implements SchemaContextFactory {
             this.supportedFeatures = supportedFeatures;
             this.statementParserMode = Preconditions.checkNotNull(statementParserMode);
             switch (statementParserMode) {
-            case SEMVER_MODE:
-                this.getIdentifier = ASTSchemaSource::getSemVerIdentifier;
-                break;
-            default:
-                this.getIdentifier = ASTSchemaSource::getIdentifier;
+                case SEMVER_MODE:
+                    this.getIdentifier = ASTSchemaSource::getSemVerIdentifier;
+                    break;
+                default:
+                    this.getIdentifier = ASTSchemaSource::getIdentifier;
             }
         }
 
index b920383b9006843150b4711fb643395ab9721ff6..6c615b58a9414613e9fc7eac24ed92b13657ac04 100644 (file)
@@ -12,7 +12,6 @@ import com.google.common.base.Preconditions;
 import com.google.common.cache.CacheBuilder;
 import com.google.common.cache.CacheLoader;
 import com.google.common.cache.LoadingCache;
-
 import javax.annotation.Nonnull;
 import org.opendaylight.yangtools.concepts.Identifiable;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
@@ -23,11 +22,10 @@ import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
 import org.opendaylight.yangtools.yang.model.repo.util.AbstractSchemaRepository;
 
 /**
- * A {@link SchemaRepository} which allows sharing of {@link SchemaContext} as
- * long as their specification is the same.
+ * A {@link SchemaRepository} which allows sharing of {@link SchemaContext} as long as their specification is the same.
  *
- * Note: for current implementation, "same" means the same filter and the same
- * set of {@link SourceIdentifier}s.
+ * <p>
+ * Note: for current implementation, "same" means the same filter and the same set of {@link SourceIdentifier}s.
  */
 @Beta
 public final class SharedSchemaRepository extends AbstractSchemaRepository implements Identifiable<String> {
index 1e1b3882e3764f191505665dd76f56e4d0291db0..debdb6e9826bed3a3576e20846b30917a5076f26 100644 (file)
@@ -86,10 +86,10 @@ public final class YangTextSchemaContextResolver implements AutoCloseable, Schem
      * Register a {@link YangTextSchemaSource}.
      *
      * @param source YANG text source
+     * @return a YangTextSchemaSourceRegistration
      * @throws YangSyntaxErrorException When the YANG file is syntactically invalid
      * @throws IOException when the URL is not readable
      * @throws SchemaSourceException When parsing encounters general error
-     * @return a YangTextSchemaSourceRegistration
      */
     public YangTextSchemaSourceRegistration registerSource(@Nonnull final YangTextSchemaSource source)
             throws SchemaSourceException, IOException, YangSyntaxErrorException {
@@ -155,10 +155,10 @@ public final class YangTextSchemaContextResolver implements AutoCloseable, Schem
      * Register a URL containing a YANG text.
      *
      * @param url YANG text source URL
+     * @return a YangTextSchemaSourceRegistration for this URL
      * @throws YangSyntaxErrorException When the YANG file is syntactically invalid
      * @throws IOException when the URL is not readable
      * @throws SchemaSourceException When parsing encounters general error
-     * @return a YangTextSchemaSourceRegistration for this URL
      */
     public YangTextSchemaSourceRegistration registerSource(@Nonnull final URL url) throws SchemaSourceException,
             IOException, YangSyntaxErrorException {
@@ -191,6 +191,7 @@ public final class YangTextSchemaContextResolver implements AutoCloseable, Schem
 
     /**
      * Try to parse all currently available yang files and build new schema context.
+     *
      * @return new schema context iif there is at least 1 yang file registered and
      *         new schema context was successfully built.
      */
@@ -199,8 +200,7 @@ public final class YangTextSchemaContextResolver implements AutoCloseable, Schem
     }
 
     /**
-     * Try to parse all currently available yang files and build new schema context
-     * in dependence on specified parsing mode.
+     * Try to parse all currently available yang files and build new schema context depending on specified parsing mode.
      *
      * @param statementParserMode mode of statement parser
      * @return new schema context iif there is at least 1 yang file registered and
@@ -209,7 +209,7 @@ public final class YangTextSchemaContextResolver implements AutoCloseable, Schem
     public Optional<SchemaContext> getSchemaContext(final StatementParserMode statementParserMode) {
         final SchemaContextFactory factory = repository.createSchemaContextFactory(SchemaSourceFilter.ALWAYS_ACCEPT);
         Optional<SchemaContext> sc;
-        Object v;
+        Object ver;
         do {
             // Spin get stable context version
             Object cv;
@@ -224,9 +224,9 @@ public final class YangTextSchemaContextResolver implements AutoCloseable, Schem
             // Version has been updated
             Collection<SourceIdentifier> sources;
             do {
-                v = version;
+                ver = version;
                 sources = ImmutableSet.copyOf(requiredSources);
-            } while (v != version);
+            } while (ver != version);
 
             while (true) {
                 final CheckedFuture<SchemaContext, SchemaResolutionException> f = factory.createSchemaContext(sources,
@@ -245,10 +245,10 @@ public final class YangTextSchemaContextResolver implements AutoCloseable, Schem
             synchronized (this) {
                 if (contextVersion == cv) {
                     currentSchemaContext.set(sc);
-                    contextVersion = v;
+                    contextVersion = ver;
                 }
             }
-        } while (version == v);
+        } while (version == ver);
 
         return sc;
     }
index 9e5ad0b02863c1905db897137c8e6d1cfd367a36..1ee3f9f38f3ad5b655338e710acbd55c70a8f543 100644 (file)
@@ -57,7 +57,9 @@ final class StatementSourceReferenceHandler extends DefaultHandler {
     }
 
     @Override
-    public void startElement(final String uri, final String localName, final String qName, final Attributes attributes) {
+    @SuppressWarnings("checkstyle:parameterName")
+    public void startElement(final String uri, final String localName, final String qName,
+            final Attributes attributes) {
         addTextIfNeeded();
         final Element el = doc.createElementNS(uri, qName);
         for (int i = 0, len = attributes.getLength(); i < len; i++) {
@@ -95,4 +97,4 @@ final class StatementSourceReferenceHandler extends DefaultHandler {
             sb.setLength(0);
         }
     }
-}
\ No newline at end of file
+}
index 156fbe8c7cedd5a181584083bfd03a9eb1b78466..51a39fb80592bfacb51896081e3daa75ebbee231 100644 (file)
@@ -46,6 +46,7 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.ModelProcessingPhase;
 import org.opendaylight.yangtools.yang.parser.spi.meta.MutableStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
 import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour.NamespaceStorageNode;
+import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour.Registry;
 import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour.StorageNodeType;
 import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceNotAvailableException;
 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
@@ -65,11 +66,11 @@ import org.opendaylight.yangtools.yang.parser.stmt.reactor.SourceSpecificContext
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-class BuildGlobalContext extends NamespaceStorageSupport implements NamespaceBehaviour.Registry {
+class BuildGlobalContext extends NamespaceStorageSupport implements Registry {
     private static final Logger LOG = LoggerFactory.getLogger(BuildGlobalContext.class);
 
-    private static final List<ModelProcessingPhase> PHASE_EXECUTION_ORDER = ImmutableList
-            .<ModelProcessingPhase> builder().add(ModelProcessingPhase.SOURCE_PRE_LINKAGE)
+    private static final List<ModelProcessingPhase> PHASE_EXECUTION_ORDER =
+            ImmutableList.<ModelProcessingPhase>builder().add(ModelProcessingPhase.SOURCE_PRE_LINKAGE)
             .add(ModelProcessingPhase.SOURCE_LINKAGE).add(ModelProcessingPhase.STATEMENT_DEFINITION)
             .add(ModelProcessingPhase.FULL_DECLARATION).add(ModelProcessingPhase.EFFECTIVE_MODEL).build();
 
@@ -378,8 +379,9 @@ class BuildGlobalContext extends NamespaceStorageSupport implements NamespaceBeh
                     switch (sourceProgress) {
                         case FINISHED:
                             currentSource.remove();
-                            // Fallback to progress, since we were able to make
-                            // progress in computation
+                            // we were able to make progress in computation
+                            progressing = true;
+                            break;
                         case PROGRESS:
                             progressing = true;
                             break;
index 122fad30133d8ff3e80629d3800661a0b882aeda..3e4ff416403947fead54af1a82cb3ddef8f7cae3 100644 (file)
@@ -33,12 +33,8 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.StatementSupportBundle;
 import org.opendaylight.yangtools.yang.parser.spi.source.StatementStreamSource;
 import org.opendaylight.yangtools.yang.parser.spi.validation.ValidationBundlesNamespace.ValidationBundleType;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangStatementSourceImpl;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 public final class CrossSourceStatementReactor {
-    private static final Logger LOG = LoggerFactory.getLogger(CrossSourceStatementReactor.class);
-
     private final Map<ModelProcessingPhase, StatementSupportBundle> supportedTerminology;
     private final Map<ValidationBundleType, Collection<?>> supportedValidation;
 
@@ -124,8 +120,8 @@ public final class CrossSourceStatementReactor {
      * @return A new {@link BuildAction}.
      * @throws NullPointerException if statementParserMode is null
      *
-     * @deprecated Use {@link #newBuild(StatementParserMode)} and then call setSupportedFeatures()
-     * on the created BuildAction instead.
+     * @deprecated Use {@link #newBuild(StatementParserMode)} and then call setSupportedFeatures() on the created
+     *             BuildAction instead.
      */
     @Deprecated
     public BuildAction newBuild(final StatementParserMode statementParserMode,
@@ -148,8 +144,8 @@ public final class CrossSourceStatementReactor {
      * @return A new {@link BuildAction}.
      * @throws NullPointerException if statementParserMode is null
      *
-     * @deprecated Use {@link #newBuild(StatementParserMode)} and then call setSupportedFeatures()
-     * on the created BuildAction instead.
+     * @deprecated Use {@link #newBuild(StatementParserMode)} and then call setSupportedFeatures() on the created
+     *             BuildAction instead.
      */
     @Deprecated
     public BuildAction newBuild(final StatementParserMode statementParserMode,
@@ -195,8 +191,7 @@ public final class CrossSourceStatementReactor {
         }
 
         /**
-         * Add main source. All main sources are present in resulting
-         * SchemaContext.
+         * Add main source. All main sources are present in resulting SchemaContext.
          *
          * @param source
          *            which should be added into main sources
@@ -206,8 +201,7 @@ public final class CrossSourceStatementReactor {
         }
 
         /**
-         * Add main sources. All main sources are present in resulting
-         * SchemaContext.
+         * Add main sources. All main sources are present in resulting SchemaContext.
          *
          * @param sources
          *            which should be added into main sources
@@ -223,10 +217,10 @@ public final class CrossSourceStatementReactor {
         }
 
         /**
-         * Add library sources. Only library sources required by main sources
-         * are present in resulting SchemaContext. Any other library sources are
-         * ignored and this also applies to error reporting.
+         * Add library sources. Only library sources required by main sources are present in resulting SchemaContext.
+         * Any other library sources are ignored and this also applies to error reporting.
          *
+         * <p>
          * Library sources are not supported in semantic version mode currently.
          *
          * @param libSources
@@ -273,8 +267,7 @@ public final class CrossSourceStatementReactor {
         }
 
         /**
-         * @throws org.opendaylight.yangtools.yang.parser.spi.source.SourceException
-         * @throws ReactorException
+         * Build the effective model context.
          */
         public EffectiveModelContext build() throws ReactorException {
             return context.build();
@@ -285,6 +278,8 @@ public final class CrossSourceStatementReactor {
         }
 
         /**
+         * Add specified sources and assemble the resulting SchemaContext.
+         *
          * @deprecated Use {@link #addSources(Collection)} and {@link #buildEffective()} instead.
          */
         @Deprecated
@@ -306,6 +301,8 @@ public final class CrossSourceStatementReactor {
         }
 
         /**
+         * Add specified sources and assemble the resulting SchemaContext.
+         *
          * @deprecated Use {@link #addSources(Collection)} and {@link #buildEffective()} instead.
          */
         @Deprecated
@@ -317,4 +314,4 @@ public final class CrossSourceStatementReactor {
             return buildEffective();
         }
     }
-}
\ No newline at end of file
+}
index d0dc9cfc430cb3037dc445f4a0546a45eba8d8ca..13e7700cf423852aab67b7153782607ec90e351d 100644 (file)
@@ -46,11 +46,13 @@ public final class EffectiveSchemaContext extends SimpleSchemaContext {
     }
 
     /**
+     * Resolve SchemaContext for a set of modules.
+     *
      * @deprecated Use {@link SimpleSchemaContext#forModules(Set)} instead.
      */
     @Deprecated
     public static SchemaContext resolveSchemaContext(final Set<Module> modules) {
-       return SimpleSchemaContext.forModules(modules);
+        return SimpleSchemaContext.forModules(modules);
     }
 
     @VisibleForTesting
index e917f958ef65a026d840982fc7866999e79e551d..5a7a62137eeb17307a65848ae14860cd2da5aefe 100644 (file)
@@ -61,8 +61,9 @@ final class ModifierImpl implements ModelActionBuilder {
         Preconditions.checkState(action == null, "Action was already registered.");
     }
 
-    private static IllegalStateException shouldNotHappenProbablyBug(final SourceException e) {
-        return new IllegalStateException("Source exception during registering prerequisite. This is probably bug.", e);
+    private static IllegalStateException shouldNotHappenProbablyBug(final SourceException cause) {
+        return new IllegalStateException("Source exception during registering prerequisite. This is probably bug.",
+            cause);
     }
 
     private boolean removeSatisfied() {
@@ -125,9 +126,10 @@ final class ModifierImpl implements ModelActionBuilder {
     }
 
     @SuppressWarnings({ "rawtypes", "unchecked" })
-    private <K, C extends StmtContext.Mutable<?, ?, ?> , N extends IdentifierNamespace<K, ? extends StmtContext<?, ?, ?>>>
-            AbstractPrerequisite<C> mutatesCtxImpl(final StmtContext<?, ?, ?> context, final Class<N> namespace,
-                    final K key, final ModelProcessingPhase phase) {
+    private <K, C extends StmtContext.Mutable<?, ?, ?>,
+        N extends IdentifierNamespace<K, ? extends StmtContext<?, ?, ?>>> AbstractPrerequisite<C> mutatesCtxImpl(
+                final StmtContext<?, ?, ?> context, final Class<N> namespace, final K key,
+                final ModelProcessingPhase phase) {
         checkNotRegistered();
 
         try {
@@ -142,7 +144,8 @@ final class ModifierImpl implements ModelActionBuilder {
     }
 
     private static StatementContextBase<?,?,?> contextImpl(final Object value) {
-        Preconditions.checkArgument(value instanceof StatementContextBase,"Supplied context was not provided by this reactor.");
+        Preconditions.checkArgument(value instanceof StatementContextBase,
+            "Supplied context %s is not provided by this reactor.", value);
         return StatementContextBase.class.cast(value);
     }
 
@@ -158,7 +161,8 @@ final class ModifierImpl implements ModelActionBuilder {
 
     @Nonnull
     @Override
-    public <C extends Mutable<?, ?, ?>, CT extends C> Prerequisite<C> mutatesCtx(final CT context, final ModelProcessingPhase phase) {
+    public <C extends Mutable<?, ?, ?>, CT extends C> Prerequisite<C> mutatesCtx(final CT context,
+            final ModelProcessingPhase phase) {
         try {
             return addMutation(new PhaseMutation<>(contextImpl(context), phase));
         } catch (InferenceException e) {
@@ -168,64 +172,73 @@ final class ModifierImpl implements ModelActionBuilder {
 
     @Nonnull
     @Override
-    public <A,D extends DeclaredStatement<A>,E extends EffectiveStatement<A, D>> AbstractPrerequisite<StmtContext<A, D, E>> requiresCtx(final StmtContext<A, D, E> context, final ModelProcessingPhase phase) {
+    public <A,D extends DeclaredStatement<A>,E extends EffectiveStatement<A, D>>
+            AbstractPrerequisite<StmtContext<A, D, E>> requiresCtx(final StmtContext<A, D, E> context,
+                    final ModelProcessingPhase phase) {
         return requiresCtxImpl(context, phase);
     }
 
 
     @Nonnull
     @Override
-    public <K, N extends StatementNamespace<K, ?, ? >> Prerequisite<StmtContext<?,?,?>> requiresCtx(final StmtContext<?, ?, ?> context, final Class<N> namespace, final K key, final ModelProcessingPhase phase) {
+    public <K, N extends StatementNamespace<K, ?, ?>> Prerequisite<StmtContext<?, ?, ?>> requiresCtx(
+            final StmtContext<?, ?, ?> context, final Class<N> namespace, final K key,
+            final ModelProcessingPhase phase) {
         return requiresCtxImpl(context, namespace, key, phase);
     }
 
     @Nonnull
     @Override
-    public <D extends DeclaredStatement<?>> Prerequisite<D> requiresDeclared(final StmtContext<?, ? extends D, ?> context) {
+    public <D extends DeclaredStatement<?>> Prerequisite<D> requiresDeclared(
+            final StmtContext<?, ? extends D, ?> context) {
         return requiresCtxImpl(context, FULL_DECLARATION).transform(StmtContext::buildDeclared);
     }
 
     @Nonnull
     @Override
-    public <K, D extends DeclaredStatement<?>, N extends StatementNamespace<K, ? extends D, ?>> AbstractPrerequisite<StmtContext<?, D, ?>> requiresDeclaredCtx(
-            final StmtContext<?, ?, ?> context, final Class<N> namespace, final K key) {
-        return requiresCtxImpl(context, namespace, key, FULL_DECLARATION);
+    public <K, D extends DeclaredStatement<?>, N extends StatementNamespace<K, ? extends D, ?>> Prerequisite<D>
+            requiresDeclared(final StmtContext<?, ?, ?> context, final Class<N> namespace, final K key) {
+        final AbstractPrerequisite<StmtContext<?, D, ?>> rawContext = requiresCtxImpl(context, namespace, key,
+            FULL_DECLARATION);
+        return rawContext.transform(StmtContext::buildDeclared);
     }
 
     @Nonnull
     @Override
-    public <K, D extends DeclaredStatement<?>, N extends StatementNamespace<K, ? extends D, ?>> Prerequisite<D> requiresDeclared(
-            final StmtContext<?, ?, ?> context, final Class<N> namespace, final K key) {
-        final AbstractPrerequisite<StmtContext<?, D, ?>> rawContext = requiresCtxImpl(context, namespace, key, FULL_DECLARATION);
-        return rawContext.transform(StmtContext::buildDeclared);
+    public <K, D extends DeclaredStatement<?>, N extends StatementNamespace<K, ? extends D, ?>>
+            AbstractPrerequisite<StmtContext<?, D, ?>> requiresDeclaredCtx(final StmtContext<?, ?, ?> context,
+                    final Class<N> namespace, final K key) {
+        return requiresCtxImpl(context, namespace, key, FULL_DECLARATION);
     }
 
     @Nonnull
     @Override
-    public <E extends EffectiveStatement<?, ?>> Prerequisite<E> requiresEffective(final StmtContext<?, ?, ? extends E> stmt) {
+    public <E extends EffectiveStatement<?, ?>> Prerequisite<E> requiresEffective(
+            final StmtContext<?, ?, ? extends E> stmt) {
         return requiresCtxImpl(stmt, EFFECTIVE_MODEL).transform(StmtContext::buildEffective);
     }
 
     @Nonnull
     @Override
-    public <K, E extends EffectiveStatement<?, ?>, N extends StatementNamespace<K, ?, ? extends E>> AbstractPrerequisite<StmtContext<?, ?, E>> requiresEffectiveCtx(
-            final StmtContext<?, ?, ?> context, final Class<N> namespace, final K key) {
-        return requiresCtxImpl(contextImpl(context), namespace, key, EFFECTIVE_MODEL);
+    public <K, E extends EffectiveStatement<?, ?>, N extends StatementNamespace<K, ?, ? extends E>> Prerequisite<E>
+            requiresEffective(final StmtContext<?, ?, ?> context, final Class<N> namespace, final K key) {
+        final AbstractPrerequisite<StmtContext<?,?,E>> rawContext = requiresCtxImpl(context, namespace, key,
+            EFFECTIVE_MODEL);
+        return rawContext.transform(StmtContext::buildEffective);
     }
 
     @Nonnull
     @Override
-    public <K, E extends EffectiveStatement<?, ?>, N extends StatementNamespace<K, ?, ? extends E>> Prerequisite<E> requiresEffective(
-            final StmtContext<?, ?, ?> context, final Class<N> namespace, final K key) {
-        final AbstractPrerequisite<StmtContext<?,?,E>> rawContext = requiresCtxImpl(context, namespace, key, EFFECTIVE_MODEL);
-        return rawContext.transform(StmtContext::buildEffective);
+    public <K, E extends EffectiveStatement<?, ?>, N extends StatementNamespace<K, ?, ? extends E>>
+            AbstractPrerequisite<StmtContext<?, ?, E>> requiresEffectiveCtx(final StmtContext<?, ?, ?> context,
+                    final Class<N> namespace, final K key) {
+        return requiresCtxImpl(contextImpl(context), namespace, key, EFFECTIVE_MODEL);
     }
 
-
     @Nonnull
     @Override
-    public <N extends IdentifierNamespace<?, ?>> Prerequisite<Mutable<?, ?, ?>> mutatesNs(final Mutable<?, ?, ?> context,
-            final Class<N> namespace) {
+    public <N extends IdentifierNamespace<?, ?>> Prerequisite<Mutable<?, ?, ?>> mutatesNs(
+            final Mutable<?, ?, ?> context, final Class<N> namespace) {
         try {
             return addMutation(new NamespaceMutation<>(contextImpl(context), namespace));
         } catch (SourceException e) {
@@ -235,8 +248,9 @@ final class ModifierImpl implements ModelActionBuilder {
 
     @Nonnull
     @Override
-    public <K, E extends EffectiveStatement<?, ?>, N extends IdentifierNamespace<K, ? extends StmtContext<?, ?, ?>>> AbstractPrerequisite<Mutable<?, ?, E>> mutatesEffectiveCtx(
-            final StmtContext<?, ?, ?> context, final Class<N> namespace, final K key) {
+    public <K, E extends EffectiveStatement<?, ?>, N extends IdentifierNamespace<K, ? extends StmtContext<?, ?, ?>>>
+            AbstractPrerequisite<Mutable<?, ?, E>> mutatesEffectiveCtx(final StmtContext<?, ?, ?> context,
+                    final Class<N> namespace, final K key) {
         return mutatesCtxImpl(context, namespace, key, EFFECTIVE_MODEL);
     }
 
@@ -247,7 +261,6 @@ final class ModifierImpl implements ModelActionBuilder {
     }
 
     private abstract class AbstractPrerequisite<T> implements Prerequisite<T> {
-
         private boolean done = false;
         private T value;
 
@@ -284,7 +297,7 @@ final class ModifierImpl implements ModelActionBuilder {
 
     private class PhaseMutation<C> extends AbstractPrerequisite<C> implements ContextMutation {
         @SuppressWarnings("unchecked")
-        public PhaseMutation(final StatementContextBase<?, ?, ?> context, final ModelProcessingPhase phase) {
+        PhaseMutation(final StatementContextBase<?, ?, ?> context, final ModelProcessingPhase phase) {
             context.addMutation(phase, this);
             resolvePrereq((C) context);
         }
@@ -295,7 +308,8 @@ final class ModifierImpl implements ModelActionBuilder {
         }
     }
 
-    private class PhaseFinished<C extends StmtContext<?, ?, ?>> extends AbstractPrerequisite<C> implements OnPhaseFinished {
+    private class PhaseFinished<C extends StmtContext<?, ?, ?>> extends AbstractPrerequisite<C>
+            implements OnPhaseFinished {
         @SuppressWarnings("unchecked")
         @Override
         public boolean phaseFinished(final StatementContextBase<?, ?, ?> context, final ModelProcessingPhase phase) {
@@ -303,24 +317,25 @@ final class ModifierImpl implements ModelActionBuilder {
         }
     }
 
-    private class NamespaceMutation<N extends IdentifierNamespace<?,?>> extends AbstractPrerequisite<StmtContext.Mutable<?, ?, ?>>  {
-        public NamespaceMutation(final StatementContextBase<?, ?, ?> ctx, final Class<N> namespace) {
+    private class NamespaceMutation<N extends IdentifierNamespace<?,?>>
+            extends AbstractPrerequisite<Mutable<?, ?, ?>>  {
+        NamespaceMutation(final StatementContextBase<?, ?, ?> ctx, final Class<N> namespace) {
             resolvePrereq(ctx);
         }
     }
 
-    private class AddedToNamespace<C extends StmtContext<?,?,?>> extends AbstractPrerequisite<C> implements OnNamespaceItemAdded,OnPhaseFinished {
+    private class AddedToNamespace<C extends StmtContext<?,?,?>> extends AbstractPrerequisite<C>
+            implements OnNamespaceItemAdded, OnPhaseFinished {
         private final ModelProcessingPhase phase;
 
-        public <K, N extends StatementNamespace<K, ?, ?>> AddedToNamespace(final ModelProcessingPhase phase) {
+        AddedToNamespace(final ModelProcessingPhase phase) {
             this.phase = phase;
         }
 
         @Override
-        public void namespaceItemAdded(final StatementContextBase<?, ?, ?> context, final Class<?> namespace, final Object key,
-                final Object value) {
-            StatementContextBase<?, ?, ?> targetContext = (StatementContextBase<?, ?, ?>) value;
-            targetContext.addPhaseCompletedListener(phase, this);
+        public void namespaceItemAdded(final StatementContextBase<?, ?, ?> context, final Class<?> namespace,
+                final Object key, final Object value) {
+            ((StatementContextBase<?, ?, ?>) value).addPhaseCompletedListener(phase, this);
         }
 
         @SuppressWarnings("unchecked")
@@ -335,18 +350,19 @@ final class ModifierImpl implements ModelActionBuilder {
         }
     }
 
-    private class PhaseModificationInNamespace<C extends Mutable<?,?,?>> extends AbstractPrerequisite<C> implements OnNamespaceItemAdded, ContextMutation {
+    private class PhaseModificationInNamespace<C extends Mutable<?,?,?>> extends AbstractPrerequisite<C>
+            implements OnNamespaceItemAdded, ContextMutation {
         private final ModelProcessingPhase modPhase;
 
-        public <K, N extends StatementNamespace<K, ?, ?>> PhaseModificationInNamespace(final ModelProcessingPhase phase) {
+        PhaseModificationInNamespace(final ModelProcessingPhase phase) {
             Preconditions.checkArgument(phase != null, "Model processing phase must not be null");
             this.modPhase = phase;
         }
 
         @SuppressWarnings("unchecked")
         @Override
-        public void namespaceItemAdded(final StatementContextBase<?, ?, ?> context, final Class<?> namespace, final Object key,
-                final Object value) {
+        public void namespaceItemAdded(final StatementContextBase<?, ?, ?> context, final Class<?> namespace,
+                final Object key, final Object value) {
             StatementContextBase<?, ?, ?> targetCtx = contextImpl(value);
             targetCtx.addMutation(modPhase, this);
             resolvePrereq((C) targetCtx);
index 83225d064989013da61c4143330ddf75cfd38da4..9682e84a75462c46cdc4144a49cfacf60cbcaa6f 100644 (file)
@@ -21,7 +21,7 @@ abstract class NamespaceBehaviourWithListeners<K, V, N extends IdentifierNamespa
         private final NamespaceStorageNode ctxNode;
         private final K key;
 
-        public ValueAddedListener(final NamespaceStorageNode contextNode, final K key) {
+        ValueAddedListener(final NamespaceStorageNode contextNode, final K key) {
             this.ctxNode = contextNode;
             this.key = key;
         }
@@ -44,7 +44,6 @@ abstract class NamespaceBehaviourWithListeners<K, V, N extends IdentifierNamespa
     protected final NamespaceBehaviour<K, V, N> delegate;
     private final List<VirtualNamespaceContext<?, V, ?, K>> derivedNamespaces = new ArrayList<>();
 
-
     protected NamespaceBehaviourWithListeners(final NamespaceBehaviour<K, V, N> delegate) {
         super(delegate.getIdentifier());
         this.delegate = delegate;
@@ -55,10 +54,10 @@ abstract class NamespaceBehaviourWithListeners<K, V, N extends IdentifierNamespa
     protected abstract boolean isRequestedValue(ValueAddedListener<K> listener, NamespaceStorageNode storage, V value);
 
     @Override
-    public abstract void addTo(final NamespaceStorageNode storage, final K key, final V value);
+    public abstract void addTo(NamespaceStorageNode storage, K key, V value);
 
-    protected void notifyListeners(final NamespaceStorageNode storage, final Iterator<ValueAddedListener<K>> keyListeners,
-            final V value) {
+    protected void notifyListeners(final NamespaceStorageNode storage,
+            final Iterator<ValueAddedListener<K>> keyListeners, final V value) {
         List<ValueAddedListener<K>> toNotify = new ArrayList<>();
         while (keyListeners.hasNext()) {
             ValueAddedListener<K> listener = keyListeners.next();
index ba55707b374bb0fce7785c8916c1d5db3c29a2ea..6ca662a455f97dc3bec88184bb76f6b322479bc3 100644 (file)
@@ -17,8 +17,8 @@ import javax.annotation.Nonnull;
 import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
 import org.opendaylight.yangtools.yang.model.api.ModuleIdentifier;
 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
-import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
 import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour.NamespaceStorageNode;
+import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour.Registry;
 import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceNotAvailableException;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StatementNamespace;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
@@ -32,9 +32,11 @@ abstract class NamespaceStorageSupport implements NamespaceStorageNode {
     public abstract NamespaceStorageNode getParentNamespaceStorage();
 
     /**
+     * Return the registry of a source context.
+     *
      * @return registry of source context
      */
-    public abstract NamespaceBehaviour.Registry getBehaviourRegistry();
+    public abstract Registry getBehaviourRegistry();
 
     protected void checkLocalNamespaceAllowed(final Class<? extends IdentifierNamespace<?, ?>> type) {
         // NOOP
@@ -53,10 +55,10 @@ abstract class NamespaceStorageSupport implements NamespaceStorageNode {
     @Nonnull
     public final <K,V, KT extends K, N extends IdentifierNamespace<K, V>> V getFromNamespace(final Class<N> type,
             final KT key) throws NamespaceNotAvailableException {
-        return getBehaviourRegistry().getNamespaceBehaviour(type).getFrom(this,key);
+        return getBehaviourRegistry().getNamespaceBehaviour(type).getFrom(this, key);
     }
 
-    public final <K, V, N extends IdentifierNamespace<K, V>> Map<K, V> getAllFromNamespace(final Class<N> type){
+    public final <K, V, N extends IdentifierNamespace<K, V>> Map<K, V> getAllFromNamespace(final Class<N> type) {
         return getBehaviourRegistry().getNamespaceBehaviour(type).getAllFrom(this);
     }
 
index 31f197e79ce7d8191d9bd7bf18afc50053e0bc01..a917e53d6abe6f4eee1ed3e2eb347183c0edc318 100644 (file)
@@ -68,19 +68,15 @@ public class RootStatementContext<A, D extends DeclaredStatement<A>, E extends E
         this.setRootIdentifier(identifier);
     }
 
-    /**
-     * @return null as root cannot have parent
-     */
     @Override
     public StatementContextBase<?, ?, ?> getParentContext() {
+        // null as root cannot have parent
         return null;
     }
 
-    /**
-     * @return namespace storage of source context
-     */
     @Override
     public NamespaceStorageNode getParentNamespaceStorage() {
+        // namespace storage of source context
         return sourceContext;
     }
 
@@ -93,12 +89,11 @@ public class RootStatementContext<A, D extends DeclaredStatement<A>, E extends E
     public StorageNodeType getStorageNodeType() {
         return StorageNodeType.ROOT_STATEMENT_LOCAL;
     }
-    /**
-     * @return this as its own root
-     */
+
     @Nonnull
     @Override
     public RootStatementContext<?, ?, ?> getRoot() {
+        // this as its own root
         return this;
     }
 
index 3f9341a9ebe616a728b69afd33b2bd2d7c383067..48a06d0a7e0b1717c31244d096db13f6a05cc887 100644 (file)
@@ -67,8 +67,9 @@ public class SourceSpecificContext implements NamespaceStorageNode, NamespaceBeh
     }
 
     private static final Logger LOG = LoggerFactory.getLogger(SourceSpecificContext.class);
+
     private final Multimap<ModelProcessingPhase, ModifierImpl> modifiers = HashMultimap.create();
-    private final QNameToStatementDefinitionMap qNameToStmtDefMap = new QNameToStatementDefinitionMap();
+    private final QNameToStatementDefinitionMap qnameToStmtDefMap = new QNameToStatementDefinitionMap();
     private final PrefixToModuleMap prefixToModuleMap = new PrefixToModuleMap();
     private final BuildGlobalContext currentContext;
     private final StatementStreamSource source;
@@ -88,7 +89,7 @@ public class SourceSpecificContext implements NamespaceStorageNode, NamespaceBeh
         this.source = Preconditions.checkNotNull(source);
     }
 
-    boolean isEnabledSemanticVersioning(){
+    boolean isEnabledSemanticVersioning() {
         return currentContext.isEnabledSemanticVersioning();
     }
 
@@ -113,7 +114,7 @@ public class SourceSpecificContext implements NamespaceStorageNode, NamespaceBeh
         if (def == null) {
             def = currentContext.getModelDefinedStatementDefinition(name);
             if (def == null) {
-                final StatementSupport<?, ?, ?> extension = qNameToStmtDefMap.get(name);
+                final StatementSupport<?, ?, ?> extension = qnameToStmtDefMap.get(name);
                 if (extension != null) {
                     def = new StatementDefinitionContext<>(extension);
                     currentContext.putModelDefinedStatementDefinition(name, def);
@@ -158,14 +159,15 @@ public class SourceSpecificContext implements NamespaceStorageNode, NamespaceBeh
             root = new RootStatementContext<>(this, def, ref, argument);
         } else if (!RootStatementContext.DEFAULT_VERSION.equals(root.getRootVersion())
                 && inProgressPhase == ModelProcessingPhase.SOURCE_LINKAGE) {
-            root = new RootStatementContext<>(this, def, ref, argument, root.getRootVersion(), root.getRootIdentifier());
+            root = new RootStatementContext<>(this, def, ref, argument, root.getRootVersion(),
+                    root.getRootIdentifier());
         } else {
             final QName rootStatement = root.definition().getStatementName();
             final String rootArgument = root.rawStatementArgument();
 
             Preconditions.checkState(Objects.equals(def.getStatementName(), rootStatement)
-                && Objects.equals(argument, rootArgument),
-                "Root statement was already defined as '%s %s'.", rootStatement, rootArgument);
+                && Objects.equals(argument, rootArgument), "Root statement was already defined as '%s %s'.",
+                rootStatement, rootArgument);
         }
         return root;
     }
@@ -199,8 +201,7 @@ public class SourceSpecificContext implements NamespaceStorageNode, NamespaceBeh
 
         final Collection<ModifierImpl> previousModifiers = modifiers.get(previousPhase);
         Preconditions.checkState(previousModifiers.isEmpty(),
-            "Previous phase %s has unresolved modifiers %s in source %s",
-            previousPhase, previousModifiers, source);
+            "Previous phase %s has unresolved modifiers %s in source %s", previousPhase, previousModifiers, source);
 
         inProgressPhase = phase;
         LOG.debug("Source {} started phase {}", source, phase);
@@ -364,13 +365,16 @@ public class SourceSpecificContext implements NamespaceStorageNode, NamespaceBeh
                 source.writePreLinkage(new StatementContextWriter(this, inProgressPhase), stmtDef());
                 break;
             case SOURCE_LINKAGE:
-                source.writeLinkage(new StatementContextWriter(this, inProgressPhase), stmtDef(), preLinkagePrefixes(), getRootVersion());
+                source.writeLinkage(new StatementContextWriter(this, inProgressPhase), stmtDef(), preLinkagePrefixes(),
+                    getRootVersion());
                 break;
             case STATEMENT_DEFINITION:
-                source.writeLinkageAndStatementDefinitions(new StatementContextWriter(this, inProgressPhase), stmtDef(), prefixes(), getRootVersion());
+                source.writeLinkageAndStatementDefinitions(new StatementContextWriter(this, inProgressPhase), stmtDef(),
+                    prefixes(), getRootVersion());
                 break;
             case FULL_DECLARATION:
-                source.writeFull(new StatementContextWriter(this, inProgressPhase), stmtDef(), prefixes(), getRootVersion());
+                source.writeFull(new StatementContextWriter(this, inProgressPhase), stmtDef(), prefixes(),
+                    getRootVersion());
                 break;
             default:
                 break;
@@ -390,10 +394,10 @@ public class SourceSpecificContext implements NamespaceStorageNode, NamespaceBeh
     }
 
     private PrefixToModule prefixes() {
-        final Map<String, ModuleIdentifier> allPrefixes = getRoot().getAllFromNamespace(ImpPrefixToModuleIdentifier
-                .class);
-        final Map<String, ModuleIdentifier> belongsToPrefixes = getRoot().getAllFromNamespace
-                (BelongsToPrefixToModuleIdentifier.class);
+        final Map<String, ModuleIdentifier> allPrefixes = getRoot().getAllFromNamespace(
+            ImpPrefixToModuleIdentifier.class);
+        final Map<String, ModuleIdentifier> belongsToPrefixes = getRoot().getAllFromNamespace(
+            BelongsToPrefixToModuleIdentifier.class);
         if (belongsToPrefixes != null) {
             allPrefixes.putAll(belongsToPrefixes);
         }
@@ -407,12 +411,12 @@ public class SourceSpecificContext implements NamespaceStorageNode, NamespaceBeh
     private QNameToStatementDefinition stmtDef() {
         // regular YANG statements and extension supports added
         final StatementSupportBundle supportsForPhase = currentContext.getSupportsForPhase(inProgressPhase);
-        qNameToStmtDefMap.putAll(supportsForPhase.getCommonDefinitions());
-        qNameToStmtDefMap.putAll(supportsForPhase.getDefinitionsSpecificForVersion(getRootVersion()));
+        qnameToStmtDefMap.putAll(supportsForPhase.getCommonDefinitions());
+        qnameToStmtDefMap.putAll(supportsForPhase.getDefinitionsSpecificForVersion(getRootVersion()));
 
         // No further actions needed
         if (inProgressPhase != ModelProcessingPhase.FULL_DECLARATION) {
-            return qNameToStmtDefMap;
+            return qnameToStmtDefMap;
         }
 
         // We need to any and all extension statements which have been declared in the context
@@ -420,7 +424,7 @@ public class SourceSpecificContext implements NamespaceStorageNode, NamespaceBeh
                 StatementDefinitionNamespace.class);
         if (extensions != null) {
             extensions.forEach((qname, support) -> {
-                final StatementSupport<?, ?, ?> existing = qNameToStmtDefMap.putIfAbsent(qname, support);
+                final StatementSupport<?, ?, ?> existing = qnameToStmtDefMap.putIfAbsent(qname, support);
                 if (existing != null) {
                     LOG.debug("Source {} already defines statement {} as {}", source, qname, existing);
                 } else {
@@ -429,7 +433,7 @@ public class SourceSpecificContext implements NamespaceStorageNode, NamespaceBeh
             });
         }
 
-        return qNameToStmtDefMap;
+        return qnameToStmtDefMap;
     }
 
     public Set<YangVersion> getSupportedVersions() {
index 4637dd08202bb2e0634851aabfa00191d085394b..498894cc0a69d4f4e19f4485fbea87ed625737af 100644 (file)
@@ -43,6 +43,7 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.NamespaceBehaviour;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StatementNamespace;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StatementSupport;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
+import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext.Mutable;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContextUtils;
 import org.opendaylight.yangtools.yang.parser.spi.source.ImplicitSubstatement;
 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
@@ -54,29 +55,29 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public abstract class StatementContextBase<A, D extends DeclaredStatement<A>, E extends EffectiveStatement<A, D>>
-        extends NamespaceStorageSupport implements StmtContext.Mutable<A, D, E> {
+        extends NamespaceStorageSupport implements Mutable<A, D, E> {
     /**
-     * event listener when an item is added to model namespace.
+     * Event listener when an item is added to model namespace.
      */
     interface OnNamespaceItemAdded extends EventListener {
         /**
-         * @throws SourceException
+         * Invoked whenever a new item is added to a namespace.
          */
         void namespaceItemAdded(StatementContextBase<?, ?, ?> context, Class<?> namespace, Object key, Object value);
     }
 
     /**
-     * event listener when a parsing {@link ModelProcessingPhase} is completed.
+     * Event listener when a parsing {@link ModelProcessingPhase} is completed.
      */
     interface OnPhaseFinished extends EventListener {
         /**
-         * @throws SourceException
+         * Invoked whenever a processing phase has finished.
          */
         boolean phaseFinished(StatementContextBase<?, ?, ?> context, ModelProcessingPhase phase);
     }
 
     /**
-     * interface for all mutations within an {@link ModelActionBuilder.InferenceAction}.
+     * Interface for all mutations within an {@link ModelActionBuilder.InferenceAction}.
      */
     interface ContextMutation {
 
@@ -226,6 +227,8 @@ public abstract class StatementContextBase<A, D extends DeclaredStatement<A>, E
     public abstract StatementContextBase<?, ?, ?> getParentContext();
 
     /**
+     * Returns the model root for this statement.
+     *
      * @return root context of statement
      */
     @Nonnull
@@ -233,6 +236,8 @@ public abstract class StatementContextBase<A, D extends DeclaredStatement<A>, E
     public abstract RootStatementContext<?, ?, ?> getRoot();
 
     /**
+     * Returns the origin of the statement.
+     *
      * @return origin of statement
      */
     @Nonnull
@@ -242,6 +247,8 @@ public abstract class StatementContextBase<A, D extends DeclaredStatement<A>, E
     }
 
     /**
+     * Returns a reference to statement source.
+     *
      * @return reference of statement source
      */
     @Nonnull
@@ -282,7 +289,8 @@ public abstract class StatementContextBase<A, D extends DeclaredStatement<A>, E
         return Collections.unmodifiableCollection(effective);
     }
 
-    public void removeStatementsFromEffectiveSubstatements(final Collection<? extends StmtContext<?, ?, ?>> substatements) {
+    public void removeStatementsFromEffectiveSubstatements(
+            final Collection<? extends StmtContext<?, ?, ?>> substatements) {
         if (!effective.isEmpty()) {
             effective.removeAll(substatements);
             shrinkEffective();
@@ -312,11 +320,12 @@ public abstract class StatementContextBase<A, D extends DeclaredStatement<A>, E
     }
 
     /**
-     * Removes a statement context from the effective substatements
-     * based on its statement definition (i.e statement keyword) and raw (in String form) statement argument.
-     * The statement context is removed only if both statement definition and statement argument match with
-     * one of the effective substatements' statement definition and argument.
+     * Removes a statement context from the effective substatements based on its statement definition (i.e statement
+     * keyword) and raw (in String form) statement argument. The statement context is removed only if both statement
+     * definition and statement argument match with one of the effective substatements' statement definition
+     * and argument.
      *
+     * <p>
      * If the statementArg parameter is null, the statement context is removed based only on its statement definition.
      *
      * @param statementDef statement definition of the statement context to remove
@@ -344,7 +353,7 @@ public abstract class StatementContextBase<A, D extends DeclaredStatement<A>, E
     }
 
     /**
-     * adds effective statement to collection of substatements
+     * Adds an effective statement to collection of substatements.
      *
      * @param substatement substatement
      * @throws IllegalStateException
@@ -358,7 +367,7 @@ public abstract class StatementContextBase<A, D extends DeclaredStatement<A>, E
     }
 
     /**
-     * adds effective statement to collection of substatements
+     * Adds an effective statement to collection of substatements.
      *
      * @param substatements substatements
      * @throws IllegalStateException
@@ -396,9 +405,10 @@ public abstract class StatementContextBase<A, D extends DeclaredStatement<A>, E
      * @param argument statement argument
      * @return A new substatement
      */
-    public final <CA, CD extends DeclaredStatement<CA>, CE extends EffectiveStatement<CA, CD>> StatementContextBase<CA, CD, CE> createSubstatement(
-            final int offset, final StatementDefinitionContext<CA, CD, CE> def, final StatementSourceReference ref,
-            final String argument) {
+    public final <CA, CD extends DeclaredStatement<CA>, CE extends EffectiveStatement<CA, CD>>
+            StatementContextBase<CA, CD, CE> createSubstatement(final int offset,
+                    final StatementDefinitionContext<CA, CD, CE> def, final StatementSourceReference ref,
+                    final String argument) {
         final ModelProcessingPhase inProgressPhase = getRoot().getSourceContext().getInProgressPhase();
         Preconditions.checkState(inProgressPhase != ModelProcessingPhase.EFFECTIVE_MODEL,
                 "Declared statement cannot be added in effective phase at: %s", getStatementSourceReference());
@@ -531,15 +541,14 @@ public abstract class StatementContextBase<A, D extends DeclaredStatement<A>, E
 
     /**
      * Ends declared section of current node.
-     *
-     * @param ref
-     * @throws SourceException
      */
     void endDeclared(final StatementSourceReference ref, final ModelProcessingPhase phase) {
         definition().onDeclarationFinished(this, phase);
     }
 
     /**
+     * Return the context in which this statement was defined.
+     *
      * @return statement definition
      */
     protected final StatementDefinitionContext<A, D, E> definition() {
@@ -598,12 +607,9 @@ public abstract class StatementContextBase<A, D extends DeclaredStatement<A>, E
     }
 
     /**
-     * adds {@link OnPhaseFinished} listener for a {@link ModelProcessingPhase} end
-     *
-     * @throws SourceException
+     * Adds {@link OnPhaseFinished} listener for a {@link ModelProcessingPhase} end.
      */
     void addPhaseCompletedListener(final ModelProcessingPhase phase, final OnPhaseFinished listener) {
-
         Preconditions.checkNotNull(phase, "Statement context processing phase cannot be null at: %s",
                 getStatementSourceReference());
         Preconditions.checkNotNull(listener, "Statement context phase listener cannot be null at: %s",
@@ -625,7 +631,7 @@ public abstract class StatementContextBase<A, D extends DeclaredStatement<A>, E
     }
 
     /**
-     * adds {@link ContextMutation} to {@link ModelProcessingPhase}
+     * Adds a {@link ContextMutation} to a {@link ModelProcessingPhase}.
      *
      * @throws IllegalStateException
      *             when the mutation was registered after phase was completed
@@ -633,10 +639,8 @@ public abstract class StatementContextBase<A, D extends DeclaredStatement<A>, E
     void addMutation(final ModelProcessingPhase phase, final ContextMutation mutation) {
         ModelProcessingPhase finishedPhase = completedPhase;
         while (finishedPhase != null) {
-            if (phase.equals(finishedPhase)) {
-                throw new IllegalStateException("Mutation registered after phase was completed at: "  +
-                        getStatementSourceReference());
-            }
+            Preconditions.checkState(!phase.equals(finishedPhase),
+                "Mutation registered after phase was completed at: %s", getStatementSourceReference());
             finishedPhase = finishedPhase.getPreviousPhase();
         }
 
index 93602ce45d1103d1148887ef4c772ef3fc5c752e..bab8ef1d23dd0fd74e637fe27e543e142839a470 100644 (file)
@@ -65,23 +65,22 @@ public class StatementDefinitionContext<A, D extends DeclaredStatement<A>, E ext
         return false;
     }
 
-
     public void onDeclarationFinished(final Mutable<A, D, E> statement, final ModelProcessingPhase phase) {
         switch (phase) {
-        case SOURCE_PRE_LINKAGE:
-            support.onPreLinkageDeclared(statement);
-            break;
-        case SOURCE_LINKAGE:
-            support.onLinkageDeclared(statement);
-            break;
-        case STATEMENT_DEFINITION:
-            support.onStatementDefinitionDeclared(statement);
-            break;
-        case FULL_DECLARATION:
-            support.onFullDefinitionDeclared(statement);
-            break;
-        default:
-            break;
+            case SOURCE_PRE_LINKAGE:
+                support.onPreLinkageDeclared(statement);
+                break;
+            case SOURCE_LINKAGE:
+                support.onLinkageDeclared(statement);
+                break;
+            case STATEMENT_DEFINITION:
+                support.onStatementDefinitionDeclared(statement);
+                break;
+            case FULL_DECLARATION:
+                support.onFullDefinitionDeclared(statement);
+                break;
+            default:
+                break;
         }
     }
 
index 028f9067de34cd81354abaec1dcff64bd6c483ee..7c632a99492fff8ce3ad268546bf1af149cb6692 100644 (file)
@@ -91,7 +91,7 @@ abstract class StatementMap {
         @Override
         int size() {
             return countElements(elements);
-       }
+        }
     }
 
     static int countElements(final Object[] elements) {
index 8fa166e0a47bb84dcdbd38b673f74de2795efc5c..a0b9710e7ef63b60d6fd669b89beb948a2ae2d6f 100644 (file)
@@ -46,10 +46,11 @@ final class SubstatementContext<A, D extends DeclaredStatement<A>, E extends Eff
     private final A argument;
 
     /**
-     * config statements are not all that common which means we are performing a recursive search towards the root
+     * Config statements are not all that common which means we are performing a recursive search towards the root
      * every time {@link #isConfiguration()} is invoked. This is quite expensive because it causes a linear search
      * for the (usually non-existent) config statement.
      *
+     * <p>
      * This field maintains a resolution cache, so once we have returned a result, we will keep on returning the same
      * result without performing any lookups.
      */
index 656b5bef15225b4f59c9234fbb3be7e55138b28e..8316de062e0b3e88eec75b661a4c715ac9d6c17a 100644 (file)
@@ -83,8 +83,8 @@ public class ActionStatementImpl extends AbstractDeclaredStatement<QName> implem
         public EffectiveStatement<QName, ActionStatement> createEffective(
                 final StmtContext<QName, ActionStatement, EffectiveStatement<QName, ActionStatement>> ctx) {
             SourceException.throwIf(StmtContextUtils.hasAncestorOfType(ctx, ILLEGAL_PARENTS),
-                    ctx.getStatementSourceReference(), "Action %s is defined within a notification, rpc or another action",
-                    ctx.getStatementArgument());
+                    ctx.getStatementSourceReference(),
+                    "Action %s is defined within a notification, rpc or another action", ctx.getStatementArgument());
             SourceException.throwIf(!StmtContextUtils.hasAncestorOfTypeWithChildOfType(ctx, YangStmtMapping.LIST,
                     YangStmtMapping.KEY), ctx.getStatementSourceReference(),
                     "Action %s is defined within a list that has no key statement", ctx.getStatementArgument());
index 0556f7e036292ca0e44a5242a36c56751cb17736..74ca32f491387376c3462796bf93301d8c2ae093 100644 (file)
@@ -64,7 +64,8 @@ public final class AnydataStatementImpl extends AbstractDeclaredStatement<QName>
         }
 
         @Override
-        public void onStatementAdded(final Mutable<QName, AnydataStatement, EffectiveStatement<QName, AnydataStatement>> stmt) {
+        public void onStatementAdded(final Mutable<QName, AnydataStatement,
+                EffectiveStatement<QName, AnydataStatement>> stmt) {
             stmt.getParentContext().addToNs(ChildSchemaNodes.class, stmt.getStatementArgument(), stmt);
         }
 
@@ -129,5 +130,4 @@ public final class AnydataStatementImpl extends AbstractDeclaredStatement<QName>
     public MandatoryStatement getMandatory() {
         return firstDeclared(MandatoryStatement.class);
     }
-
 }
index 4141052a155e05a3bc18128dcdb66e3052b19da3..f25292106ad72aefdc40f880ecde2d2b026f6680 100644 (file)
@@ -32,9 +32,8 @@ public final class ModifierStatementImpl extends AbstractDeclaredStatement<Modif
         super(context);
     }
 
-    public static class Definition
-            extends
-            AbstractStatementSupport<ModifierKind, ModifierStatement, EffectiveStatement<ModifierKind, ModifierStatement>> {
+    public static class Definition extends AbstractStatementSupport<ModifierKind, ModifierStatement,
+            EffectiveStatement<ModifierKind, ModifierStatement>> {
 
         public Definition() {
             super(YangStmtMapping.MODIFIER);
@@ -53,7 +52,8 @@ public final class ModifierStatementImpl extends AbstractDeclaredStatement<Modif
 
         @Override
         public EffectiveStatement<ModifierKind, ModifierStatement> createEffective(
-                final StmtContext<ModifierKind, ModifierStatement, EffectiveStatement<ModifierKind, ModifierStatement>> ctx) {
+                final StmtContext<ModifierKind, ModifierStatement,
+                EffectiveStatement<ModifierKind, ModifierStatement>> ctx) {
             return new ModifierEffectiveStatementImpl(ctx);
         }
 
index ef620f7ad85cbc9db14f1ce240863413da76b073..eeef7c7e10c4ac713d9bb3b3cb70e8e2591e901b 100644 (file)
@@ -53,15 +53,16 @@ public final class NotificationStatementRfc7950Support extends NotificationState
     @Override
     public EffectiveStatement<QName, NotificationStatement> createEffective(
             final StmtContext<QName, NotificationStatement, EffectiveStatement<QName, NotificationStatement>> ctx) {
-        SourceException
-                .throwIf(StmtContextUtils.hasAncestorOfType(ctx, ILLEGAL_PARENTS), ctx.getStatementSourceReference(),
-                        "Notification %s is defined within an rpc, action, or another notification",
-                        ctx.getStatementArgument());
+        SourceException.throwIf(StmtContextUtils.hasAncestorOfType(ctx, ILLEGAL_PARENTS),
+            ctx.getStatementSourceReference(),
+            "Notification %s is defined within an rpc, action, or another notification",
+            ctx.getStatementArgument());
         SourceException.throwIf(!StmtContextUtils.hasAncestorOfTypeWithChildOfType(ctx, YangStmtMapping.LIST,
-                YangStmtMapping.KEY), ctx.getStatementSourceReference(),
-                "Notification %s is defined within a list that has no key statement", ctx.getStatementArgument());
-        SourceException.throwIf(StmtContextUtils.hasParentOfType(ctx, YangStmtMapping.CASE), ctx.getStatementSourceReference(),
-                "Notification %s is defined within a case statement", ctx.getStatementArgument());
+            YangStmtMapping.KEY), ctx.getStatementSourceReference(),
+            "Notification %s is defined within a list that has no key statement", ctx.getStatementArgument());
+        SourceException.throwIf(StmtContextUtils.hasParentOfType(ctx, YangStmtMapping.CASE),
+            ctx.getStatementSourceReference(), "Notification %s is defined within a case statement",
+            ctx.getStatementArgument());
         return new NotificationEffectiveStatementImpl(ctx);
     }
 
index 25127b79f8b9c8d37a0f9b1080a67dab8f95d9b2..2252525c789358f60b3b6a8e1c4facc9f7d5e231 100644 (file)
@@ -19,10 +19,10 @@ import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.TypeUtils;
  */
 @Beta
 public final class TypeStatementRfc7950Support extends TypeStatementImpl.Definition {
-    private static final Map<String, StatementSupport<?, ?, ?>> ARGUMENT_SPECIFIC_SUPPORTS = ImmutableMap
-            .<String, StatementSupport<?, ?, ?>> builder()
-            .put(TypeUtils.LEAF_REF, new LeafrefSpecificationRfc7950Support())
-            .put(TypeUtils.IDENTITY_REF, new IdentityrefSpecificationRfc7950Support()).build();
+    private static final Map<String, StatementSupport<?, ?, ?>> ARGUMENT_SPECIFIC_SUPPORTS =
+            ImmutableMap.<String, StatementSupport<?, ?, ?>>of(
+                TypeUtils.LEAF_REF, new LeafrefSpecificationRfc7950Support(),
+                TypeUtils.IDENTITY_REF, new IdentityrefSpecificationRfc7950Support());
 
     @Override
     public boolean hasArgumentSpecificSupports() {
index 73a4bf0d712dab8e83196dd48762f18303796d1e..1a4ee61bed80081203116dd7cd2a940fdb0206f1 100644 (file)
@@ -28,7 +28,8 @@ import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.InputEffect
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.OutputEffectiveStatementImpl;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.TypeDefEffectiveStatementImpl;
 
-public class ActionEffectiveStatementImpl extends AbstractEffectiveSchemaNode<ActionStatement> implements ActionDefinition {
+public class ActionEffectiveStatementImpl extends AbstractEffectiveSchemaNode<ActionStatement>
+        implements ActionDefinition {
     private final ContainerSchemaNode input;
     private final ContainerSchemaNode output;
     private final Set<TypeDefinition<?>> typeDefinitions;
index cd4571b458165814194ff40e3b2f30b51f4675a2..e3e998a7cae002a483273bffec9d11560dd3ac38 100644 (file)
@@ -24,7 +24,8 @@ import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.ContainerEf
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.UnknownEffectiveStatementBase;
 
 /**
- * Effective statement representation of 'yang-data' extension defined in https://tools.ietf.org/html/rfc8040#section-8
+ * Effective statement representation of 'yang-data' extension defined in
+ * <a href="https://tools.ietf.org/html/rfc8040#section-8">RFC 8040</a>.
  */
 @Beta
 public final class YangDataEffectiveStatement extends UnknownEffectiveStatementBase<String>
index 9062c1027449447eed18e968e8f73c767f0a6b11..2e33a373bb6d7925a4f418ba98c717cb71803dbb 100644 (file)
@@ -17,7 +17,8 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.SupportedExtensionsMapping;
 
 /**
- * Declared statement representation of 'yang-data' extension defined in https://tools.ietf.org/html/rfc8040#section-8
+ * Declared statement representation of 'yang-data' extension defined in
+ * <a href="https://tools.ietf.org/html/rfc8040#section-8">RFC 8040</a>.
  */
 @Beta
 public final class YangDataStatement extends AbstractDeclaredStatement<String> implements UnknownStatement<String> {
index 44aaeba0bd208df7f8a3b31826e597e9c35de093..fda0a17581840c7e210ca85ca47a85f6c9b35a74 100644 (file)
@@ -24,14 +24,13 @@ import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
 import org.opendaylight.yangtools.yang.parser.impl.util.YangModelDependencyInfo;
 
 /**
- * Abstract Syntax Tree representation of a schema source. This representation
- * is internal to the YANG parser implementation, as it relies on ANTLR types.
+ * Abstract Syntax Tree representation of a schema source. This representation is internal to the YANG parser
+ * implementation, as it relies on ANTLR types.
  *
- * Instances of this representation are used for caching purposes, as they
- * are a natural intermediate step in YANG text processing pipeline: the text
- * has been successfully parsed, so we know it is syntactically correct. It also
- * passes basic semantic validation and we were able to extract dependency
- * information.
+ * <p>
+ * Instances of this representation are used for caching purposes, as they are a natural intermediate step in YANG text
+ * processing pipeline: the text has been successfully parsed, so we know it is syntactically correct. It also passes
+ * basic semantic validation and we were able to extract dependency information.
  */
 @Beta
 public final class ASTSchemaSource implements SchemaSourceRepresentation {
@@ -80,20 +79,6 @@ public final class ASTSchemaSource implements SchemaSourceRepresentation {
         return new ASTSchemaSource(id, semVerId, tree, depInfo, null);
     }
 
-    private static SourceIdentifier getSourceId(final YangModelDependencyInfo depInfo) {
-        final String name = depInfo.getName();
-        return depInfo.getFormattedRevision() == null ? RevisionSourceIdentifier.create(name)
-                : RevisionSourceIdentifier.create(name, depInfo.getFormattedRevision());
-    }
-
-    private static SemVerSourceIdentifier getSemVerSourceId(final YangModelDependencyInfo depInfo) {
-        return depInfo.getFormattedRevision() == null
-                ? SemVerSourceIdentifier.create(depInfo.getName(),
-                    depInfo.getSemanticVersion().or(DEFAULT_SEMANTIC_VERSION))
-                        : SemVerSourceIdentifier.create(depInfo.getName(), depInfo.getFormattedRevision(),
-                            depInfo.getSemanticVersion().or(DEFAULT_SEMANTIC_VERSION));
-    }
-
     /**
      * Create a new instance of AST representation for a abstract syntax tree,
      * performing minimal semantic analysis to acquire dependency information.
@@ -201,12 +186,25 @@ public final class ASTSchemaSource implements SchemaSourceRepresentation {
     /**
      * Return the dependency information as extracted from the AST.
      *
-     * FIXME: this method should be extracted into a public interface in the
-     *        model.api.repo class, relying solely on model.api types.
-     *
      * @return Dependency information.
      */
+    // FIXME: this method should be extracted into a public interface in the model.api.repo class, relying solely
+    //        on model.api types.
     @Nonnull public YangModelDependencyInfo getDependencyInformation() {
         return depInfo;
     }
+
+    private static SourceIdentifier getSourceId(final YangModelDependencyInfo depInfo) {
+        final String name = depInfo.getName();
+        return depInfo.getFormattedRevision() == null ? RevisionSourceIdentifier.create(name)
+                : RevisionSourceIdentifier.create(name, depInfo.getFormattedRevision());
+    }
+
+    private static SemVerSourceIdentifier getSemVerSourceId(final YangModelDependencyInfo depInfo) {
+        return depInfo.getFormattedRevision() == null
+                ? SemVerSourceIdentifier.create(depInfo.getName(),
+                    depInfo.getSemanticVersion().or(DEFAULT_SEMANTIC_VERSION))
+                        : SemVerSourceIdentifier.create(depInfo.getName(), depInfo.getFormattedRevision(),
+                            depInfo.getSemanticVersion().or(DEFAULT_SEMANTIC_VERSION));
+    }
 }
index 0e7017ae5c5bff67554d65151a0e23ff82c46964..3b36e36fbae233d5597988a3209b46b3f531d5da 100644 (file)
@@ -22,7 +22,7 @@ import org.opendaylight.yangtools.yang.model.api.Module;
 @Deprecated
 public final class ModuleDependencySort {
     /**
-     * It is not desirable to instance this class
+     * It is not desirable to instance this class.
      */
     private ModuleDependencySort() {
     }
index b9b48ac2dade1feacbd0f04006c59795d71cc37b..3cf9e1c83885d0a409c8a152a9ca6210350bcef3 100644 (file)
@@ -33,6 +33,8 @@ import org.slf4j.LoggerFactory;
 public final class TextToASTTransformer extends SchemaSourceTransformer<YangTextSchemaSource, ASTSchemaSource> {
 
     /**
+     * A text-to-AST Transformation.
+     *
      * @deprecated Use {@link TextToASTTransformer#transformText(YangTextSchemaSource)} instead.
      */
     @Deprecated
@@ -57,6 +59,8 @@ public final class TextToASTTransformer extends SchemaSourceTransformer<YangText
     }
 
     /**
+     * Singleton instance of {@link TextToASTTransformation}.
+     *
      * @deprecated Use {@link TextToASTTransformer#transformText(YangTextSchemaSource)} instead.
      */
     @Deprecated
index c416d353dabf527cbdce04566c8b9eaeb89167c0..e896f1c34f91fa7307111671ee6bace75231b729 100644 (file)
@@ -43,7 +43,7 @@ public class ConstraintDefinitionsTest {
         final SchemaContext schemaContext = reactor.buildEffective(Arrays.asList(source));
         assertNotNull(schemaContext);
 
-        final Module testModule = schemaContext.findModuleByName( "foo",
+        final Module testModule = schemaContext.findModuleByName("foo",
             SimpleDateFormatUtil.getRevisionFormat().parse("2016-09-20"));
         assertNotNull(testModule);
 
@@ -117,7 +117,7 @@ public class ConstraintDefinitionsTest {
         assertFalse(ConstraintDefinitions.equals(constraints3, constraints4));
 
         final String constraintsString = ConstraintDefinitions.toString(constraints4);
-        assertEquals("EffectiveConstraintDefinitionImpl{whenCondition=foo = 'bar', mustConstraints=[bar != 'foo'], " +
-                "mandatory=true, minElements=50, maxElements=100}", constraintsString);
+        assertEquals("EffectiveConstraintDefinitionImpl{whenCondition=foo = 'bar', mustConstraints=[bar != 'foo'], "
+                "mandatory=true, minElements=50, maxElements=100}", constraintsString);
     }
 }
\ No newline at end of file