Mass-migrate to Objects.requireNonNull()
[yangtools.git] / yang / yang-parser-impl / src / main / java / org / opendaylight / yangtools / yang / parser / repo / YangTextSchemaContextResolver.java
index 8d688bd00962cfc1b643e4389b9bd44989c70cd7..1955136d169564484f44575d8c78fde1f804994f 100644 (file)
@@ -8,12 +8,12 @@
 package org.opendaylight.yangtools.yang.parser.repo;
 
 import static com.google.common.base.Preconditions.checkArgument;
+import static java.util.Objects.requireNonNull;
 import static org.opendaylight.yangtools.util.concurrent.FluentFutures.immediateFailedFluentFuture;
 import static org.opendaylight.yangtools.util.concurrent.FluentFutures.immediateFluentFuture;
 
 import com.google.common.annotations.Beta;
 import com.google.common.base.MoreObjects.ToStringHelper;
-import com.google.common.base.Preconditions;
 import com.google.common.base.Verify;
 import com.google.common.collect.ArrayListMultimap;
 import com.google.common.collect.ImmutableSet;
@@ -30,7 +30,7 @@ import java.util.concurrent.ConcurrentLinkedDeque;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicReference;
-import javax.annotation.Nonnull;
+import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.common.Revision;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException;
@@ -72,8 +72,8 @@ public final class YangTextSchemaContextResolver implements AutoCloseable, Schem
     private volatile Object contextVersion = version;
 
     private YangTextSchemaContextResolver(final SchemaRepository repository, final SchemaSourceRegistry registry) {
-        this.repository = Preconditions.checkNotNull(repository);
-        this.registry = Preconditions.checkNotNull(registry);
+        this.repository = requireNonNull(repository);
+        this.registry = requireNonNull(registry);
 
         final TextToASTTransformer t = TextToASTTransformer.create(repository, registry);
         transReg = registry.registerSchemaSourceListener(t);
@@ -96,7 +96,7 @@ public final class YangTextSchemaContextResolver implements AutoCloseable, Schem
      * @throws IOException when the URL is not readable
      * @throws SchemaSourceException When parsing encounters general error
      */
-    public YangTextSchemaSourceRegistration registerSource(@Nonnull final YangTextSchemaSource source)
+    public @NonNull YangTextSchemaSourceRegistration registerSource(final @NonNull YangTextSchemaSource source)
             throws SchemaSourceException, IOException, YangSyntaxErrorException {
         checkArgument(source != null);
 
@@ -165,8 +165,8 @@ public final class YangTextSchemaContextResolver implements AutoCloseable, Schem
      * @throws IOException when the URL is not readable
      * @throws SchemaSourceException When parsing encounters general error
      */
-    public YangTextSchemaSourceRegistration registerSource(@Nonnull final URL url) throws SchemaSourceException,
-            IOException, YangSyntaxErrorException {
+    public @NonNull YangTextSchemaSourceRegistration registerSource(final @NonNull URL url)
+            throws SchemaSourceException, IOException, YangSyntaxErrorException {
         checkArgument(url != null, "Supplied URL must not be null");
 
         final String path = url.getPath();
@@ -185,7 +185,7 @@ public final class YangTextSchemaContextResolver implements AutoCloseable, Schem
         });
     }
 
-    private static SourceIdentifier guessSourceIdentifier(final String fileName) {
+    private static SourceIdentifier guessSourceIdentifier(final @NonNull String fileName) {
         try {
             return YangTextSchemaSource.identifierFromFilename(fileName);
         } catch (final IllegalArgumentException e) {