Adopt odlparent-10.0.0/yangtools-8.0.0-SNAPSHOT
[mdsal.git] / binding / mdsal-binding-runtime-spi / src / main / java / org / opendaylight / mdsal / binding / runtime / spi / ModuleInfoSnapshotResolver.java
index 7982e8a4121e45bc9750029ea436fff7e640efe0..8cce7aabf09e53904211f2f84ce6c948a29a2aa5 100644 (file)
@@ -16,7 +16,6 @@ import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableList.Builder;
 import com.google.common.collect.ListMultimap;
 import com.google.common.collect.MultimapBuilder;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -36,6 +35,7 @@ import org.opendaylight.mdsal.binding.spec.reflect.BindingReflections;
 import org.opendaylight.yangtools.concepts.AbstractObjectRegistration;
 import org.opendaylight.yangtools.concepts.Mutable;
 import org.opendaylight.yangtools.concepts.ObjectRegistration;
+import org.opendaylight.yangtools.concepts.Registration;
 import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.QNameModule;
@@ -43,14 +43,13 @@ import org.opendaylight.yangtools.yang.common.Revision;
 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
 import org.opendaylight.yangtools.yang.model.api.stmt.ModuleEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.SubmoduleEffectiveStatement;
-import org.opendaylight.yangtools.yang.model.parser.api.YangParserFactory;
-import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException;
 import org.opendaylight.yangtools.yang.model.repo.api.RevisionSourceIdentifier;
 import org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceException;
 import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
 import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
+import org.opendaylight.yangtools.yang.parser.api.YangParserFactory;
+import org.opendaylight.yangtools.yang.parser.api.YangSyntaxErrorException;
 import org.opendaylight.yangtools.yang.parser.repo.YangTextSchemaContextResolver;
-import org.opendaylight.yangtools.yang.parser.repo.YangTextSchemaSourceRegistration;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -62,14 +61,13 @@ import org.slf4j.LoggerFactory;
 @Beta
 public final class ModuleInfoSnapshotResolver implements Mutable {
     private static final class RegisteredModuleInfo {
-        final YangTextSchemaSourceRegistration reg;
+        final Registration reg;
         final YangModuleInfo info;
         final ClassLoader loader;
 
         private int refcount = 1;
 
-        RegisteredModuleInfo(final YangModuleInfo info, final YangTextSchemaSourceRegistration reg,
-            final ClassLoader loader) {
+        RegisteredModuleInfo(final YangModuleInfo info, final Registration reg, final ClassLoader loader) {
             this.info = requireNonNull(info);
             this.reg = requireNonNull(reg);
             this.loader = requireNonNull(loader);
@@ -145,7 +143,7 @@ public final class ModuleInfoSnapshotResolver implements Mutable {
         }
 
         // Create an explicit registration
-        final YangTextSchemaSourceRegistration reg;
+        final Registration reg;
         try {
             reg = ctxResolver.registerSource(toYangTextSource(sourceId, info));
         } catch (YangSyntaxErrorException | SchemaSourceException | IOException e) {
@@ -177,9 +175,9 @@ public final class ModuleInfoSnapshotResolver implements Mutable {
             final Optional<Revision> revision = entry.getKey().getRevision();
             final ModuleEffectiveStatement module = entry.getValue();
 
-            sources.add(RevisionSourceIdentifier.create(module.argument(), revision));
+            sources.add(RevisionSourceIdentifier.create(module.argument().getLocalName(), revision));
             module.streamEffectiveSubstatements(SubmoduleEffectiveStatement.class)
-                .map(submodule -> RevisionSourceIdentifier.create(submodule.argument(), revision))
+                .map(submodule -> RevisionSourceIdentifier.create(submodule.argument().getLocalName(), revision))
                 .forEach(sources::add);
         }
 
@@ -202,8 +200,6 @@ public final class ModuleInfoSnapshotResolver implements Mutable {
         return next;
     }
 
-    @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
-                justification = "https://github.com/spotbugs/spotbugs/issues/811")
     private synchronized void unregister(final ImmutableList<RegisteredModuleInfo> regInfos) {
         for (RegisteredModuleInfo regInfo : regInfos) {
             if (!regInfo.decRef()) {