Migrate model.repo.api to JDT annotations 33/77233/6
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 23 Oct 2018 21:11:51 +0000 (23:11 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 24 Oct 2018 09:14:10 +0000 (11:14 +0200)
This mass-migrates all of model.repo.api interfaces and classes
to use JDT nullness annotations.

Change-Id: I740d22b348d9f12cc30389e8f569b0dc912e7a57
JIRA: YANGTOOLS-907
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/repo/api/RevisionSourceIdentifier.java
yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/repo/api/SchemaContextFactory.java
yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/repo/api/SchemaContextFactoryConfiguration.java
yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/repo/api/SchemaRepository.java
yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/repo/api/SchemaResolutionException.java
yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/repo/api/SemVerSourceIdentifier.java
yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/repo/api/SourceIdentifier.java

index a0d7ba98f28876483c3484d88d8051c8dbec6d69..080155aaf46bbee5ee85d1baf653d8a11a1d4e10 100644 (file)
@@ -7,33 +7,31 @@
  */
 package org.opendaylight.yangtools.yang.model.repo.api;
 
-import static java.util.Objects.requireNonNull;
-
 import com.google.common.annotations.Beta;
 import java.util.Objects;
 import java.util.Optional;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.yangtools.yang.common.Revision;
 
 /**
  * YANG Schema revision source identifier.
  *
  * <p>
- * Simple transfer object represents revision identifier of source for YANG
- * schema (module or submodule), which consists of
+ * Simple transfer object represents revision identifier of source for YANG schema (module or submodule), which consists
+ * of
  * <ul>
  * <li>YANG schema name ({@link #getName()}
  * <li>Module revision (optional) ({link {@link #getRevision()})
  * </ul>
  *
  * <p>
- * Revision source identifier is designated to be carry only necessary
- * information to look-up YANG model source and to be used by various
- * SchemaSourceProviders.
+ * Revision source identifier is designated to be carry only necessary information to look-up YANG model source
+ * and to be used by various SchemaSourceProviders.
  *
  * <p>
- * <b>Note:</b>On source retrieval layer it is impossible to distinguish between
- * YANG module and/or submodule unless source is present.
+ * <b>Note:</b>On source retrieval layer it is impossible to distinguish between YANG module and/or submodule unless
+ * source is present.
  *
  * <p>
  * (For further reference see: http://tools.ietf.org/html/rfc6020#section-5.2
@@ -44,11 +42,9 @@ public final class RevisionSourceIdentifier extends SourceIdentifier {
     private static final long serialVersionUID = 1L;
 
     /**
-     * Creates new YANG Schema revision source identifier for sources without
-     * a revision.
+     * Creates new YANG Schema revision source identifier for sources without a revision.
      *
-     * @param name
-     *            Name of schema
+     * @param name Name of schema
      */
     RevisionSourceIdentifier(final String name) {
         super(name);
@@ -57,22 +53,18 @@ public final class RevisionSourceIdentifier extends SourceIdentifier {
     /**
      * Creates new YANG Schema revision source identifier.
      *
-     * @param name
-     *            Name of schema
-     * @param revision
-     *            Revision of source, may be null
+     * @param name Name of schema
+     * @param revision Revision of source, may be null
      */
-    RevisionSourceIdentifier(final String name, @Nullable final Revision revision) {
-        super(requireNonNull(name), revision);
+    RevisionSourceIdentifier(final String name, final @Nullable Revision revision) {
+        super(name, revision);
     }
 
     /**
      * Creates new YANG Schema revision source identifier.
      *
-     * @param name
-     *            Name of schema
-     * @param formattedRevision
-     *            Revision of source, potentially not present
+     * @param name Name of schema
+     * @param formattedRevision Revision of source, potentially not present
      */
     private RevisionSourceIdentifier(final String name, final Optional<Revision> revision) {
         super(name, revision);
@@ -81,25 +73,20 @@ public final class RevisionSourceIdentifier extends SourceIdentifier {
     /**
      * Creates new YANG Schema revision source identifier.
      *
-     * @param moduleName
-     *            Name of schema
-     * @param revision
-     *            Revision of source in format YYYY-mm-dd. If not present,
-     *            default value will be used.
+     * @param moduleName Name of schema
+     * @param revision Revision of source in format YYYY-mm-dd. If not present, default value will be used.
      */
-    public static RevisionSourceIdentifier create(final String moduleName, final Optional<Revision> revision) {
+    public static @NonNull RevisionSourceIdentifier create(final String moduleName, final Optional<Revision> revision) {
         return new RevisionSourceIdentifier(moduleName, revision);
     }
 
     /**
      * Creates new YANG Schema revision source identifier.
      *
-     * @param moduleName
-     *            Name of schema
-     * @param revision
-     *            Revision of source, may be null
+     * @param moduleName Name of schema
+     * @param revision Revision of source, may be null
      */
-    public static RevisionSourceIdentifier create(final String moduleName, @Nullable final Revision revision) {
+    public static @NonNull RevisionSourceIdentifier create(final String moduleName, final @Nullable Revision revision) {
         return new RevisionSourceIdentifier(moduleName, revision);
     }
 
@@ -110,7 +97,7 @@ public final class RevisionSourceIdentifier extends SourceIdentifier {
      * @param moduleName
      *            Name of schema
      */
-    public static RevisionSourceIdentifier create(final String moduleName) {
+    public static @NonNull RevisionSourceIdentifier create(final String moduleName) {
         return new RevisionSourceIdentifier(moduleName);
     }
 
index 84300e492fa98e2278a2d19f3e867dbdbc4c6c4a..779a1467e10e86340ec67eebff9e8dad5a3d1db4 100644 (file)
@@ -11,7 +11,7 @@ import com.google.common.annotations.Beta;
 import com.google.common.util.concurrent.ListenableFuture;
 import java.util.Collection;
 import java.util.Set;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
@@ -23,73 +23,57 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 @Beta
 public interface SchemaContextFactory {
     /**
-     * Create a new schema context containing specified sources, pulling in any
-     * dependencies they may have.
+     * Create a new schema context containing specified sources, pulling in any dependencies they may have.
      *
-     * @param requiredSources
-     *            a collection of sources which are required to be present
-     * @return A checked future, which will produce a schema context, or fail
-     *         with an explanation why the creation of the schema context
-     *         failed.
+     * @param requiredSources a collection of sources which are required to be present
+     * @return A checked future, which will produce a schema context, or fail with an explanation why the creation
+     *         of the schema context failed.
      */
-    ListenableFuture<SchemaContext> createSchemaContext(@Nonnull Collection<SourceIdentifier> requiredSources);
+    @NonNull ListenableFuture<SchemaContext> createSchemaContext(@NonNull Collection<SourceIdentifier> requiredSources);
 
     /**
-     * Create a new schema context containing specified sources, pulling in any
-     * dependencies they may have.
+     * Create a new schema context containing specified sources, pulling in any dependencies they may have.
      *
-     * @param requiredSources
-     *            a collection of sources which are required to be present
-     * @param statementParserMode
-     *            mode of statement parser
-     * @return A checked future, which will produce a schema context, or fail
-     *         with an explanation why the creation of the schema context
-     *         failed.
+     * @param requiredSources a collection of sources which are required to be present
+     * @param statementParserMode mode of statement parser
+     * @return A future which will produce a schema context, or fail with an explanation why the creation
+     *         of the schema context failed.
      * @deprecated Use SchemaContextFactoryConfiguration instead.
      */
     @Deprecated
-    default ListenableFuture<SchemaContext> createSchemaContext(final Collection<SourceIdentifier> requiredSources,
-            final StatementParserMode statementParserMode) {
+    default @NonNull ListenableFuture<SchemaContext> createSchemaContext(
+            final Collection<SourceIdentifier> requiredSources, final StatementParserMode statementParserMode) {
         return createSchemaContext(requiredSources, statementParserMode, null);
     }
 
     /**
-     * Create a new schema context containing specified sources, pulling in any
-     * dependencies they may have.
+     * Create a new schema context containing specified sources, pulling in any dependencies they may have.
      *
-     * @param requiredSources
-     *            a collection of sources which are required to be present
-     * @param supportedFeatures
-     *            set of supported features based on which all if-feature
-     *            statements in the parsed yang models are resolved
-     * @return A checked future, which will produce a schema context, or fail
-     *         with an explanation why the creation of the schema context
-     *         failed.
+     * @param requiredSources a collection of sources which are required to be present
+     * @param supportedFeatures set of supported features based on which all if-feature statements in the parsed YANG
+     *                          models are resolved
+     * @return A future which will produce a schema context, or fail with an explanation why the creation of the schema
+     *         context failed.
      * @deprecated Use SchemaContextFactoryConfiguration instead.
      */
     @Deprecated
-    default ListenableFuture<SchemaContext> createSchemaContext(
-            @Nonnull final Collection<SourceIdentifier> requiredSources, final Set<QName> supportedFeatures) {
+    default @NonNull ListenableFuture<SchemaContext> createSchemaContext(
+            final @NonNull Collection<SourceIdentifier> requiredSources, final Set<QName> supportedFeatures) {
         return createSchemaContext(requiredSources, StatementParserMode.DEFAULT_MODE, supportedFeatures);
     }
 
     /**
-     * Create a new schema context containing specified sources, pulling in any
-     * dependencies they may have.
+     * Create a new schema context containing specified sources, pulling in any dependencies they may have.
      *
-     * @param requiredSources
-     *            a collection of sources which are required to be present
-     * @param statementParserMode
-     *            mode of statement parser
-     * @param supportedFeatures
-     *            set of supported features based on which all if-feature
-     *            statements in the parsed yang models are resolved
-     * @return A checked future, which will produce a schema context, or fail
-     *         with an explanation why the creation of the schema context
-     *         failed.
+     * @param requiredSources a collection of sources which are required to be present
+     * @param statementParserMode mode of statement parser
+     * @param supportedFeatures set of supported features based on which all if-feature statements in the parsed YANG
+     *                          models are resolved
+     * @return A future which will produce a schema context, or fail with an explanation why the creation of the schema
+     *         context failed.
      * @deprecated Use SchemaContextFactoryConfiguration instead.
      */
     @Deprecated
-    ListenableFuture<SchemaContext> createSchemaContext(Collection<SourceIdentifier> requiredSources,
+    @NonNull ListenableFuture<SchemaContext> createSchemaContext(Collection<SourceIdentifier> requiredSources,
             StatementParserMode statementParserMode, Set<QName> supportedFeatures);
 }
index 99454d763c42c5c7e972bd41ad7dffbd2a5026c7..88bd74def0d24b93bb1e4f3299528615fe25d731 100644 (file)
@@ -17,7 +17,8 @@ import com.google.common.collect.SetMultimap;
 import java.util.Objects;
 import java.util.Optional;
 import java.util.Set;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.yangtools.concepts.Immutable;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.QNameModule;
@@ -26,8 +27,7 @@ import org.opendaylight.yangtools.yang.common.QNameModule;
  * SchemaContextFactory configuration class.
  *
  * <p>
- * SchemaContextFactoryConfiguration supports currently the following options to
- * be set:
+ * SchemaContextFactoryConfiguration supports currently the following options to be set:
  * <ul>
  * <li>schema source filter</li>
  * <li>statement parser mode</li>
@@ -37,27 +37,27 @@ import org.opendaylight.yangtools.yang.common.QNameModule;
  */
 @Beta
 public final class SchemaContextFactoryConfiguration implements Immutable {
-    private static final SchemaContextFactoryConfiguration DEFAULT_CONFIGURATION = new Builder().build();
+    private static final @NonNull SchemaContextFactoryConfiguration DEFAULT_CONFIGURATION = new Builder().build();
 
-    private final SchemaSourceFilter filter;
-    private final StatementParserMode statementParserMode;
-    private final Set<QName> supportedFeatures;
-    private final SetMultimap<QNameModule, QNameModule> modulesDeviatedByModules;
+    private final @NonNull SchemaSourceFilter filter;
+    private final @NonNull StatementParserMode statementParserMode;
+    private final @Nullable Set<QName> supportedFeatures;
+    private final @Nullable SetMultimap<QNameModule, QNameModule> modulesDeviatedByModules;
 
-    private SchemaContextFactoryConfiguration(final SchemaSourceFilter filter,
-            final StatementParserMode statementParserMode, final Set<QName> supportedFeatures,
-            final SetMultimap<QNameModule, QNameModule> modulesDeviatedByModules) {
+    private SchemaContextFactoryConfiguration(final @NonNull SchemaSourceFilter filter,
+            final @NonNull StatementParserMode statementParserMode, final @Nullable Set<QName> supportedFeatures,
+            final @Nullable SetMultimap<QNameModule, QNameModule> modulesDeviatedByModules) {
         this.filter = requireNonNull(filter);
         this.statementParserMode = requireNonNull(statementParserMode);
         this.supportedFeatures = supportedFeatures;
         this.modulesDeviatedByModules = modulesDeviatedByModules;
     }
 
-    public SchemaSourceFilter getSchemaSourceFilter() {
+    public @NonNull SchemaSourceFilter getSchemaSourceFilter() {
         return filter;
     }
 
-    public StatementParserMode getStatementParserMode() {
+    public @NonNull StatementParserMode getStatementParserMode() {
         return statementParserMode;
     }
 
@@ -69,11 +69,11 @@ public final class SchemaContextFactoryConfiguration implements Immutable {
         return Optional.ofNullable(modulesDeviatedByModules);
     }
 
-    public static SchemaContextFactoryConfiguration getDefault() {
+    public static @NonNull SchemaContextFactoryConfiguration getDefault() {
         return DEFAULT_CONFIGURATION;
     }
 
-    public static Builder builder() {
+    public static @NonNull Builder builder() {
         return new Builder();
     }
 
@@ -111,70 +111,61 @@ public final class SchemaContextFactoryConfiguration implements Immutable {
         private Set<QName> supportedFeatures;
 
         /**
-         * Set schema source filter which will filter available schema sources
-         * using the provided filter.
+         * Set schema source filter which will filter available schema sources using the provided filter.
          *
-         * @param filter
-         *            schema source filter which acts as the gating function
-         *            before a schema source is considered by the factory for
-         *            inclusion in the SchemaContext it produces.
+         * @param filter schema source filter which acts as the gating function before a schema source is considered
+         *               by the factory for inclusion in the SchemaContext it produces.
          * @return this builder
          */
-        public Builder setFilter(@Nonnull final SchemaSourceFilter filter) {
+        public @NonNull Builder setFilter(final @NonNull SchemaSourceFilter filter) {
             this.filter = requireNonNull(filter);
             return this;
         }
 
         /**
-         * Set yang statement parser mode.
+         * Set YANG statement parser mode.
          *
-         * @param statementParserMode
-         *            mode of yang statement parser
+         * @param statementParserMode mode of yang statement parser
          * @return this builder
          */
-        public Builder setStatementParserMode(@Nonnull final StatementParserMode statementParserMode) {
+        public @NonNull Builder setStatementParserMode(final @NonNull StatementParserMode statementParserMode) {
             this.statementParserMode = requireNonNull(statementParserMode);
             return this;
         }
 
         /**
-         * Set supported features based on which all if-feature statements in
-         * the parsed YANG modules will be resolved.
+         * Set supported features based on which all if-feature statements in the parsed YANG modules will be resolved.
          *
-         * @param supportedFeatures
-         *            Set of supported features in the final SchemaContext. If
-         *            the set is empty, no features encountered will be
-         *            supported.
+         * @param supportedFeatures Set of supported features in the final SchemaContext. If the set is empty, no
+         *                          features encountered will be supported.
          * @return this builder
          */
-        public Builder setSupportedFeatures(final Set<QName> supportedFeatures) {
+        public @NonNull Builder setSupportedFeatures(final Set<QName> supportedFeatures) {
             this.supportedFeatures = supportedFeatures != null ? ImmutableSet.copyOf(supportedFeatures) : null;
             return this;
         }
 
         /**
-         * Set YANG modules which can be deviated by specified modules during
-         * the parsing process. Map key (QNameModule) denotes a module which can
-         * be deviated by the modules in the Map value.
+         * Set YANG modules which can be deviated by specified modules during the parsing process. Map key (QNameModule)
+         * denotes a module which can be deviated by the modules in the Map value.
          *
-         * @param modulesDeviatedByModules
-         *            Map of YANG modules (Map key) which can be deviated by
-         *            specified modules (Map values) in the final SchemaContext.
-         *            If the map is empty, no deviations encountered will be
-         *            supported. If the map is null, all deviations will be applied.
+         * @param modulesDeviatedByModules Map of YANG modules (Map key) which can be deviated by specified modules
+         *                                 (Map values) in the final SchemaContext. If the map is empty, no deviations
+         *                                 encountered will be supported. If the map is null, all deviations will be
+         *                                 applied.
          * @return this builder
          */
-        public Builder setModulesDeviatedByModules(
-                final SetMultimap<QNameModule, QNameModule> modulesDeviatedByModules) {
+        public @NonNull Builder setModulesDeviatedByModules(
+                final @Nullable SetMultimap<QNameModule, QNameModule> modulesDeviatedByModules) {
             this.modulesDeviatedByModules = modulesDeviatedByModules != null
                     ? ImmutableSetMultimap.copyOf(modulesDeviatedByModules) : null;
             return this;
         }
 
         @Override
-        public SchemaContextFactoryConfiguration build() {
+        public @NonNull SchemaContextFactoryConfiguration build() {
             return new SchemaContextFactoryConfiguration(filter, statementParserMode, supportedFeatures,
                     modulesDeviatedByModules);
         }
     }
-}
\ No newline at end of file
+}
index c3936f40b09ee0465d8398223cde2576935b602b..5418e49c63fe359cff90fdec2bf728471c00d29c 100644 (file)
@@ -9,40 +9,35 @@ package org.opendaylight.yangtools.yang.model.repo.api;
 
 import com.google.common.annotations.Beta;
 import com.google.common.util.concurrent.ListenableFuture;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
 /**
- * Interface exposed by repository implementations. A schema repository is a logically
- * centralized place for model storage and creation of {@link SchemaContext} instances.
+ * Interface exposed by repository implementations. A schema repository is a logically centralized place for model
+ * storage and creation of {@link SchemaContext} instances.
  */
 @Beta
 public interface SchemaRepository {
     /**
-     * Instantiate a new {@link SchemaContextFactory}, which will filter
-     * available schema sources using the provided filter.
+     * Instantiate a new {@link SchemaContextFactory}, which will filter available schema sources using the provided
+     * filter.
      *
-     * @param filter
-     *            Filter which acts as the gating function before a schema
-     *            source is considered by the factory for inclusion in the
-     *            {@link SchemaContext} it produces.
+     * @param filter Filter which acts as the gating function before a schema source is considered by the factory
+     *               for inclusion in the {@link SchemaContext} it produces.
      * @return A new schema context factory.
-     * @deprecated Use
-     *             {@link #createSchemaContextFactory(SchemaContextFactoryConfiguration)}
-     *             instead.
+     * @deprecated Use {@link #createSchemaContextFactory(SchemaContextFactoryConfiguration)} instead.
      */
     @Deprecated
-    SchemaContextFactory createSchemaContextFactory(@Nonnull SchemaSourceFilter filter);
+    @NonNull SchemaContextFactory createSchemaContextFactory(@NonNull SchemaSourceFilter filter);
 
     /**
      * Returns {@link SchemaContextFactory} with supplied configuration.
      *
-     * @param config
-     *            configuration of schema context factory.
+     * @param config configuration of schema context factory.
      * @return schema context factory.
      */
-    SchemaContextFactory createSchemaContextFactory(@Nonnull SchemaContextFactoryConfiguration config);
+    @NonNull SchemaContextFactory createSchemaContextFactory(@NonNull SchemaContextFactoryConfiguration config);
 
-    <T extends SchemaSourceRepresentation> ListenableFuture<T> getSchemaSource(@Nonnull SourceIdentifier id,
-            @Nonnull Class<T> represetation);
+    <T extends SchemaSourceRepresentation> @NonNull ListenableFuture<T> getSchemaSource(@NonNull SourceIdentifier id,
+            @NonNull Class<T> represetation);
 }
index 608a8f7fbbd1483029d6f219a2d234dcc12d863f..cf55be15d8dd84941f4525c8e44b8254b4cabb4f 100644 (file)
@@ -15,7 +15,7 @@ import com.google.common.collect.ImmutableMultimap;
 import com.google.common.collect.Multimap;
 import java.util.Collection;
 import java.util.Collections;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.model.api.ModuleImport;
 
 /**
@@ -26,30 +26,31 @@ public class SchemaResolutionException extends SchemaSourceException {
 
     private static final long serialVersionUID = 1L;
     private final SourceIdentifier failedSource;
-    private final Multimap<SourceIdentifier, ModuleImport> unsatisfiedImports;
-    private final Collection<SourceIdentifier> resolvedSources;
+    private final @NonNull Multimap<SourceIdentifier, ModuleImport> unsatisfiedImports;
+    private final @NonNull Collection<SourceIdentifier> resolvedSources;
 
-    public SchemaResolutionException(@Nonnull final String message) {
+    public SchemaResolutionException(final @NonNull String message) {
         this(message, null);
     }
 
-    public SchemaResolutionException(@Nonnull final String message, final Throwable cause) {
+    public SchemaResolutionException(final @NonNull String message, final Throwable cause) {
         this(message, null, cause, Collections.emptySet(), ImmutableMultimap.of());
     }
 
-    public SchemaResolutionException(@Nonnull final String message, final SourceIdentifier failedSource,
+    public SchemaResolutionException(final @NonNull String message, final SourceIdentifier failedSource,
             final Throwable cause) {
         this(message, failedSource, cause, Collections.emptySet(), ImmutableMultimap.of());
     }
 
-    public SchemaResolutionException(@Nonnull final String message, final Collection<SourceIdentifier> resolvedSources,
-            final @Nonnull Multimap<SourceIdentifier, ModuleImport> unsatisfiedImports) {
+    public SchemaResolutionException(final @NonNull String message,
+            final @NonNull Collection<SourceIdentifier> resolvedSources,
+            final @NonNull Multimap<SourceIdentifier, ModuleImport> unsatisfiedImports) {
         this(message, null, null, resolvedSources, unsatisfiedImports);
     }
 
-    public SchemaResolutionException(@Nonnull final String message, final SourceIdentifier failedSource,
-            final Throwable cause, @Nonnull final Collection<SourceIdentifier> resolvedSources,
-            @Nonnull final Multimap<SourceIdentifier, ModuleImport> unsatisfiedImports) {
+    public SchemaResolutionException(final @NonNull String message, final SourceIdentifier failedSource,
+            final Throwable cause, final @NonNull Collection<SourceIdentifier> resolvedSources,
+            final @NonNull Multimap<SourceIdentifier, ModuleImport> unsatisfiedImports) {
         super(formatMessage(message, failedSource, resolvedSources, unsatisfiedImports), cause);
         this.failedSource = failedSource;
         this.unsatisfiedImports = ImmutableMultimap.copyOf(unsatisfiedImports);
@@ -73,18 +74,16 @@ public class SchemaResolutionException extends SchemaSourceException {
     }
 
     /**
-     * Return the list of sources which failed to resolve along with reasons
-     * why they were not resolved.
+     * Return the list of sources which failed to resolve along with reasons why they were not resolved.
      *
      * @return Source/reason map.
      */
-    public final Multimap<SourceIdentifier, ModuleImport> getUnsatisfiedImports() {
+    public final @NonNull Multimap<SourceIdentifier, ModuleImport> getUnsatisfiedImports() {
         return unsatisfiedImports;
     }
 
-
     // FIXME: should be leak actual mapping?
-    public final Collection<SourceIdentifier> getResolvedSources() {
+    public final @NonNull Collection<SourceIdentifier> getResolvedSources() {
         return resolvedSources;
     }
 
index 7e5e04ab0f8a947d93aefada34d9aac15f403b0a..a67f166ea2342a55373ea512272349075084a01c 100644 (file)
@@ -10,6 +10,8 @@ package org.opendaylight.yangtools.yang.model.repo.api;
 import com.google.common.annotations.Beta;
 import java.util.Objects;
 import java.util.Optional;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.yangtools.concepts.SemVer;
 import org.opendaylight.yangtools.yang.common.Revision;
 
@@ -17,8 +19,7 @@ import org.opendaylight.yangtools.yang.common.Revision;
  * YANG Schema source identifier with specified semantic version.
  *
  * <p>
- * Simple transfer object represents identifier of source for YANG schema
- * (module or submodule), which consists of
+ * Simple transfer object represents identifier of source for YANG schema (module or submodule), which consists of
  * <ul>
  * <li>YANG schema name {@link #getName()}
  * <li>Semantic version of yang schema {@link #getSemanticVersion()}
@@ -26,12 +27,12 @@ import org.opendaylight.yangtools.yang.common.Revision;
  * </ul>
  *
  * <p>
- * Source identifier is designated to be carry only necessary information to
- * look-up YANG model source and to be used by various SchemaSourceProviders.
+ * Source identifier is designated to be carry only necessary information to look-up YANG model source and to be used
+ * by various SchemaSourceProviders.
  *
  * <p>
- * <b>Note:</b>On source retrieval layer it is impossible to distinguish between
- * YANG module and/or submodule unless source is present.
+ * <b>Note:</b>On source retrieval layer it is impossible to distinguish between YANG module and/or submodule unless
+ * source is present.
  *
  * <p>
  * (For further reference see: http://tools.ietf.org/html/rfc6020#section-5.2
@@ -45,14 +46,11 @@ public final class SemVerSourceIdentifier extends SourceIdentifier {
     /**
      * Creates new YANG Schema semVer source identifier.
      *
-     * @param name
-     *            Name of schema
-     * @param revision
-     *            Revision of source, possibly not present
-     * @param semVer
-     *            semantic version of source
+     * @param name Name of schema
+     * @param revision Revision of source, possibly not present
+     * @param semVer semantic version of source
      */
-    SemVerSourceIdentifier(final String name, final Optional<Revision> revision, final SemVer semVer) {
+    SemVerSourceIdentifier(final String name, final Optional<Revision> revision, final @Nullable SemVer semVer) {
         super(name, revision);
         this.semVer = semVer;
     }
@@ -60,12 +58,10 @@ public final class SemVerSourceIdentifier extends SourceIdentifier {
     /**
      * Creates new YANG Schema semVer source identifier.
      *
-     * @param name
-     *            Name of schema
-     * @param semVer
-     *            semantic version of source
+     * @param name Name of schema
+     * @param semVer semantic version of source
      */
-    SemVerSourceIdentifier(final String name, final SemVer semVer) {
+    SemVerSourceIdentifier(final String name, final @Nullable SemVer semVer) {
         this(name, Optional.empty(), semVer);
     }
 
@@ -81,26 +77,21 @@ public final class SemVerSourceIdentifier extends SourceIdentifier {
     /**
      * Creates new YANG Schema semVer source identifier.
      *
-     * @param moduleName
-     *            Name of schema
-     * @param semVer
-     *            semantic version of source
+     * @param moduleName Name of schema
+     * @param semVer semantic version of source
      */
-    public static SemVerSourceIdentifier create(final String moduleName, final SemVer semVer) {
+    public static @NonNull SemVerSourceIdentifier create(final String moduleName, final SemVer semVer) {
         return new SemVerSourceIdentifier(moduleName, semVer);
     }
 
     /**
      * Creates new YANG Schema semVer source identifier.
      *
-     * @param moduleName
-     *            Name of schema
-     * @param revision
-     *            Revision of source in format YYYY-mm-dd
-     * @param semVer
-     *            semantic version of source
+     * @param moduleName Name of schema
+     * @param revision Revision of source in format YYYY-mm-dd
+     * @param semVer semantic version of source
      */
-    public static SemVerSourceIdentifier create(final String moduleName, final Revision revision,
+    public static @NonNull SemVerSourceIdentifier create(final String moduleName, final Revision revision,
             final SemVer semVer) {
         return new SemVerSourceIdentifier(moduleName, Optional.ofNullable(revision), semVer);
     }
@@ -108,15 +99,11 @@ public final class SemVerSourceIdentifier extends SourceIdentifier {
     /**
      * Creates new YANG Schema semVer source identifier.
      *
-     * @param moduleName
-     *            Name of schema
-     * @param revision
-     *            Optional of source revision in format YYYY-mm-dd. If not
-     *            present, default value will be used.
-     * @param semVer
-     *            semantic version of source
+     * @param moduleName Name of schema
+     * @param revision Optional of source revision in format YYYY-mm-dd. If not present, default value will be used.
+     * @param semVer semantic version of source
      */
-    public static SemVerSourceIdentifier create(final String moduleName, final Optional<Revision> revision,
+    public static @NonNull SemVerSourceIdentifier create(final String moduleName, final Optional<Revision> revision,
             final SemVer semVer) {
         return new SemVerSourceIdentifier(moduleName, revision, semVer);
     }
index 7d22a2fcb0f4ff5568ff3fe97f2dfe8366ad70f3..a6f7ba584c797e3afa9aa560d5a2c348d4c1ac51 100644 (file)
@@ -13,7 +13,8 @@ import com.google.common.annotations.Beta;
 import com.google.common.collect.Interner;
 import com.google.common.collect.Interners;
 import java.util.Optional;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.yangtools.concepts.Identifier;
 import org.opendaylight.yangtools.concepts.Immutable;
 import org.opendaylight.yangtools.yang.common.Revision;
@@ -35,14 +36,13 @@ public abstract class SourceIdentifier implements Identifier, Immutable {
     private static final Interner<SourceIdentifier> INTERNER = Interners.newWeakInterner();
     private static final long serialVersionUID = 2L;
 
-    private final Revision revision;
-    private final String name;
+    private final @Nullable Revision revision;
+    private final @NonNull String name;
 
     /**
      * Creates new YANG Schema source identifier for sources without revision.
      *
-     * @param name
-     *            Name of schema
+     * @param name Name of schema
      */
     SourceIdentifier(final String name) {
         this(name, (Revision) null);
@@ -51,12 +51,10 @@ public abstract class SourceIdentifier implements Identifier, Immutable {
     /**
      * Creates new YANG Schema source identifier.
      *
-     * @param name
-     *            Name of schema
-     * @param revision
-     *            Revision of source, may be null
+     * @param name Name of schema
+     * @param revision Revision of source, may be null
      */
-    SourceIdentifier(final String name, @Nullable final Revision revision) {
+    SourceIdentifier(final String name, final @Nullable Revision revision) {
         this.name = requireNonNull(name);
         this.revision = revision;
     }
@@ -64,10 +62,8 @@ public abstract class SourceIdentifier implements Identifier, Immutable {
     /**
      * Creates new YANG Schema source identifier.
      *
-     * @param name
-     *            Name of schema
-     * @param revision
-     *            Revision of source, possibly not present
+     * @param name Name of schema
+     * @param revision Revision of source, possibly not present
      */
     SourceIdentifier(final String name, final Optional<Revision> revision) {
         this(name, revision.orElse(null));
@@ -78,7 +74,7 @@ public abstract class SourceIdentifier implements Identifier, Immutable {
      *
      * @return Interned reference, or this object if it was interned.
      */
-    public SourceIdentifier intern() {
+    public @NonNull SourceIdentifier intern() {
         return INTERNER.intern(this);
     }
 
@@ -87,7 +83,7 @@ public abstract class SourceIdentifier implements Identifier, Immutable {
      *
      * @return model name
      */
-    public String getName() {
+    public @NonNull String getName() {
         return name;
     }
 
@@ -104,15 +100,14 @@ public abstract class SourceIdentifier implements Identifier, Immutable {
      * Returns filename for this YANG module as specified in RFC 6020.
      *
      * <p>
-     * Returns filename in format <code>name ['@' revision] '.yang'</code>,
-     * where revision is date in format YYYY-mm-dd.
+     * Returns filename in format <code>name ['@' revision] '.yang'</code>, where revision is date in format YYYY-mm-dd.
      *
      * <p>
      * @see <a href="http://tools.ietf.org/html/rfc6020#section-5.2">RFC6020</a>
      *
      * @return Filename for this source identifier.
      */
-    public String toYangFilename() {
+    public @NonNull String toYangFilename() {
         return toYangFileName(name, Optional.ofNullable(revision));
     }
 
@@ -128,7 +123,7 @@ public abstract class SourceIdentifier implements Identifier, Immutable {
      *
      * @return Filename for this source identifier.
      */
-    public static String toYangFileName(final String moduleName, final Optional<Revision> revision) {
+    public static @NonNull String toYangFileName(final String moduleName, final Optional<Revision> revision) {
         StringBuilder filename = new StringBuilder(moduleName);
         if (revision.isPresent()) {
             filename.append('@');