Apply modernization 16/83416/2
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 6 Aug 2019 08:39:43 +0000 (10:39 +0200)
committerRobert Varga <nite@hq.sk>
Tue, 6 Aug 2019 11:02:33 +0000 (11:02 +0000)
This fixes up use of old constructs pointed out by maven modernizer
plugin.

Change-Id: I3f926678763f72b195ae961ce7f220a1845fef52
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/schema/builder/impl/ImmutableUnkeyedListNodeBuilder.java
yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/FilteringSchemaContextProxy.java
yang/yang-model-util/src/test/java/org/opendaylight/yangtools/yang/model/util/BitsTypeTest.java
yang/yang-model-util/src/test/java/org/opendaylight/yangtools/yang/model/util/BooleanTypeTest.java
yang/yang-model-util/src/test/java/org/opendaylight/yangtools/yang/model/util/DataNodeIteratorTest.java
yang/yang-model-util/src/test/java/org/opendaylight/yangtools/yang/model/util/EmptyTypeTest.java
yang/yang-parser-reactor/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/SourceSpecificContext.java

index 8541716eda758159da0bf2d0b571f72220f66f27..81d10f7213fe224f2b8dcbb9eead05724804862d 100644 (file)
@@ -141,12 +141,12 @@ public class ImmutableUnkeyedListNodeBuilder implements CollectionNodeBuilder<Un
 
         @Override
         protected boolean valueEquals(final AbstractImmutableNormalizedNode<?, ?> other) {
-            return Collections.EMPTY_LIST.equals(other.getValue());
+            return Collections.emptyList().equals(other.getValue());
         }
 
         @Override
         protected int valueHashCode() {
-            return Collections.EMPTY_LIST.hashCode();
+            return 1;
         }
     }
 
index 5462606533dea7751b2944169e9a85b3f59a8804..9eeb262354823ec8d154b0eebfa6e920c4575a02 100644 (file)
@@ -17,7 +17,6 @@ import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.ImmutableSet.Builder;
 import com.google.common.collect.ImmutableSetMultimap;
-import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.google.common.collect.Multimap;
 import com.google.common.collect.Multimaps;
@@ -27,6 +26,7 @@ import java.net.URI;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
@@ -124,7 +124,7 @@ public final class FilteringSchemaContextProxy extends AbstractSchemaContext {
     private static Collection<Module> getImportedModules(final Map<ModuleId, Module> allModules,
             final Set<Module> baseModules, final TreeMultimap<String, Module> nameToModulesAll) {
 
-        List<Module> relatedModules = Lists.newLinkedList();
+        List<Module> relatedModules = new LinkedList<>();
 
         for (Module module : baseModules) {
             for (ModuleImport moduleImport : module.getImports()) {
index e3c139b06fbcb8495a669083f29653799ab11a1c..f30c3d81bf7347c7de4550cba5e48bd6ff90973b 100644 (file)
@@ -50,7 +50,7 @@ public class BitsTypeTest {
         assertEquals(Optional.empty(), bitsType.getDefaultValue());
         assertEquals("getPath should equal schemaPath", schemaPath, bitsType.getPath());
         assertEquals("Status should be CURRENT", Status.CURRENT, bitsType.getStatus());
-        assertEquals("Should be empty list", Collections.EMPTY_LIST, bitsType.getUnknownSchemaNodes());
+        assertEquals("Should be empty list", Collections.emptyList(), bitsType.getUnknownSchemaNodes());
         assertEquals("Values should be [enumPair]", Collections.singletonList(bit), bitsType.getBits());
 
         assertEquals("Hash code of bitsType should be equal",
index e992850efba02dce26ee05e48014792e6d7e1fcf..4df1815188d2ec3aa0953dfe9025dc5118359cf3 100644 (file)
@@ -36,6 +36,6 @@ public class BooleanTypeTest {
         assertEquals("Base type is null", null, boolType.getBaseType());
         assertEquals(Optional.empty(), boolType.getDefaultValue());
         assertEquals("Status CURRENT", Status.CURRENT, boolType.getStatus());
-        assertEquals("Should contain empty list", Collections.EMPTY_LIST, boolType.getUnknownSchemaNodes());
+        assertEquals("Should contain empty list", Collections.emptyList(), boolType.getUnknownSchemaNodes());
     }
 }
index a53ee589b08697d801bfd601df2bb7b81326350a..41eb9b233d42a67f20bddb5208509efbf015167a 100644 (file)
@@ -84,11 +84,11 @@ public class DataNodeIteratorTest {
     @Test
     public void createDataNodeIteratorWith() {
         assertFalse("Has no next", dataNodeIterator.hasNext());
-        assertEquals("Should be empty list", Collections.EMPTY_LIST, dataNodeIterator.allChoices());
-        assertEquals("Should be empty list", Collections.EMPTY_LIST, dataNodeIterator.allContainers());
-        assertEquals("Should be empty list", Collections.EMPTY_LIST, dataNodeIterator.allTypedefs());
-        assertEquals("Should be empty list", Collections.EMPTY_LIST, dataNodeIterator.allGroupings());
-        assertEquals("Should be empty list", Collections.EMPTY_LIST, dataNodeIterator.allLists());
+        assertEquals("Should be empty list", Collections.emptyList(), dataNodeIterator.allChoices());
+        assertEquals("Should be empty list", Collections.emptyList(), dataNodeIterator.allContainers());
+        assertEquals("Should be empty list", Collections.emptyList(), dataNodeIterator.allTypedefs());
+        assertEquals("Should be empty list", Collections.emptyList(), dataNodeIterator.allGroupings());
+        assertEquals("Should be empty list", Collections.emptyList(), dataNodeIterator.allLists());
     }
 
     @Test
index 8b16d754ce8eaec4800a9a383d7db85a254bc4a4..17bc7bf06347426aa30fa4a9251db1e40fb55077 100644 (file)
@@ -33,7 +33,7 @@ public class EmptyTypeTest {
         assertFalse(emptyType.getReference().isPresent());
         assertEquals("Units", Optional.empty(), emptyType.getUnits());
         assertFalse(emptyType.getDescription().isPresent());
-        assertEquals("UnknownSchemaNodes", Collections.EMPTY_LIST, emptyType.getUnknownSchemaNodes());
+        assertEquals("UnknownSchemaNodes", Collections.emptyList(), emptyType.getUnknownSchemaNodes());
         assertTrue("toString", emptyType.toString().contains("empty"));
     }
 }
index f11a094ed7dea2af79d7e99c80d2bab6367c71a7..279a03ac5cb41fcea7bda9b77a4d1ad47c43e923 100644 (file)
@@ -299,9 +299,8 @@ public class SourceSpecificContext implements NamespaceStorageNode, NamespaceBeh
         final Collection<ModifierImpl> currentPhaseModifiers = modifiers.get(phase);
 
         boolean hasProgressed = tryToProgress(currentPhaseModifiers);
-
-        checkNotNull(this.root, "Malformed source. Valid root element is missing.");
-        final boolean phaseCompleted = root.tryToCompletePhase(phase);
+        final boolean phaseCompleted = requireNonNull(root, "Malformed source. Valid root element is missing.")
+                .tryToCompletePhase(phase);
 
         hasProgressed |= tryToProgress(currentPhaseModifiers);