Further cleanups of code 14/39714/18
authorRobert Varga <rovarga@cisco.com>
Wed, 1 Jun 2016 14:16:18 +0000 (16:16 +0200)
committerTony Tkacik <ttkacik@cisco.com>
Wed, 15 Jun 2016 18:30:00 +0000 (18:30 +0000)
Unneeded imports, static methods, missing generics.

Change-Id: Ib3fd8282d69067c11fefbc557b4c72c3700f4e63
Signed-off-by: Robert Varga <rovarga@cisco.com>
18 files changed:
yang/yang-common/src/test/java/org/opendaylight/yangtools/yang/common/QNameTest.java
yang/yang-common/src/test/java/org/opendaylight/yangtools/yang/common/RpcResultBuilderTest.java
yang/yang-data-codec-xml/src/main/java/org/opendaylight/yangtools/yang/data/codec/xml/XmlParserStream.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/BuilderTest.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/schema/transform/dom/serializer/LeafSetDomSerializerTest.java
yang/yang-data-util/src/main/java/org/opendaylight/yangtools/yang/data/util/AbstractStringInstanceIdentifierCodec.java
yang/yang-data-util/src/main/java/org/opendaylight/yangtools/yang/data/util/LeafListEntryContextNode.java
yang/yang-data-util/src/main/java/org/opendaylight/yangtools/yang/data/util/XpathStringParsingPathArgumentBuilder.java
yang/yang-model-export/src/test/java/org/opendaylight/yangtools/yang/model/export/test/Bug4504Test.java
yang/yang-model-export/src/test/java/org/opendaylight/yangtools/yang/model/export/test/SimpleModuleTest.java
yang/yang-model-util/src/test/java/org/opendaylight/yangtools/yang/model/util/type/TypeTest.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/type/AbstractConstraintEffectiveStatement.java
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/repo/SharedSchemaRepositoryWithFeaturesTest.java
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug3874ExtensionTest.java
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug4610Test.java
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug5481.java
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug5712Test.java
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/TypesResolutionTest.java

index 81b7e4754850bfe28d80a21252a10defdea25a5a..59c91c939bbcb4a1d3abb85eada17cffcb7910ff 100644 (file)
@@ -11,7 +11,6 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
-
 import java.net.URI;
 import java.util.Date;
 import org.junit.Test;
@@ -131,7 +130,7 @@ public class QNameTest {
         assertNotNull(qNameModule.getRevisionNamespace());
     }
 
-    private void assertLocalNameFails(final String localName) {
+    private static void assertLocalNameFails(final String localName) {
         try {
             new QName((URI)null, localName);
             fail("Local name should fail:" + localName);
index ef26846400561893fdef982947dcea0ec50c6930..45991b2e285a871aefc0e06c46eb314f6543dadb 100644 (file)
@@ -11,8 +11,6 @@ package org.opendaylight.yangtools.yang.common;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
-
-import com.google.common.util.concurrent.ListenableFuture;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.ObjectInputStream;
@@ -133,7 +131,7 @@ public class RpcResultBuilderTest {
         assertEquals(rpcErrorShort.getErrorType(), rpcErrorShortWarn.getErrorType());
         assertEquals(rpcErrorLong.getErrorType(), rpcErrorLongWarn.getErrorType());
         assertEquals(rpcResultRpcResultBuilder1, rpcResultRpcResultBuilder2);
-        assertTrue(rpcResultBuilder.buildFuture() instanceof ListenableFuture);
+        assertNotNull(rpcResultBuilder.buildFuture());
         assertEquals("RpcResult [successful=true, result=null, errors=[RpcError [message=msg, severity=ERROR, " +
                 "errorType=RPC, tag=tag, applicationTag=null, info=null, cause=null]]]", rpcResult.toString());
     }
@@ -169,9 +167,9 @@ public class RpcResultBuilderTest {
                 "error message", "my-app-tag", "my-info", cause );
     }
 
-    void verifyRpcError( RpcResult<?> result, int errorIndex, ErrorSeverity expSeverity,
-            ErrorType expErrorType, String expTag, String expMessage, String expAppTag,
-            String expInfo, Throwable expCause ) {
+    void verifyRpcError( final RpcResult<?> result, final int errorIndex, final ErrorSeverity expSeverity,
+            final ErrorType expErrorType, final String expTag, final String expMessage, final String expAppTag,
+            final String expInfo, final Throwable expCause ) {
 
         List<RpcError> errors = new ArrayList<>( result.getErrors() );
         assertTrue( "Expected error at index " + errorIndex + " not found",
@@ -186,7 +184,7 @@ public class RpcResultBuilderTest {
         assertEquals( "getCause", expCause, error.getCause() );
     }
 
-    void verifyRpcResult( RpcResult<?> result, boolean expSuccess, Object expValue ) {
+    void verifyRpcResult( final RpcResult<?> result, final boolean expSuccess, final Object expValue ) {
         assertEquals( "isSuccessful", expSuccess, result.isSuccessful() );
         assertEquals( "getResult", expValue, result.getResult() );
     }
index 5ee39805fddc57f0e653fdabb170b3fde5d6b1f7..1ea337039e99465bb56fa425b5f2e112b406f632 100644 (file)
@@ -113,7 +113,7 @@ public final class XmlParserStream implements Closeable, Flushable {
         return this;
     }
 
-    private String readAnyXmlValue(final XMLStreamReader in) throws XMLStreamException {
+    private static String readAnyXmlValue(final XMLStreamReader in) throws XMLStreamException {
         String result = "";
         String anyXmlElementName = in.getLocalName();
 
@@ -241,7 +241,7 @@ public final class XmlParserStream implements Closeable, Flushable {
         return codecs.codecFor(node).deserialize(value);
     }
 
-    private AbstractNodeDataWithSchema newEntryNode(final AbstractNodeDataWithSchema parent) {
+    private static AbstractNodeDataWithSchema newEntryNode(final AbstractNodeDataWithSchema parent) {
         AbstractNodeDataWithSchema newChild;
         if (parent instanceof ListNodeDataWithSchema) {
             newChild = new ListEntryNodeDataWithSchema(parent.getSchema());
index 10bf9a2380dbb3faa3ae26cc9b39ce0f692ed5f4..3fe28f79320373a155cb88de1b60a82874e05536 100644 (file)
@@ -11,7 +11,6 @@ package org.opendaylight.yangtools.yang.data.impl.schema;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.mockito.Mockito.mock;
-
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.net.URISyntaxException;
@@ -23,6 +22,7 @@ import org.junit.Test;
 import org.opendaylight.yangtools.util.UnmodifiableCollection;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
 import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
@@ -80,8 +80,7 @@ public class BuilderTest {
     private static final MapEntryNode LIST_MAIN_CHILD_2 = ImmutableNodes.mapEntry(LIST_MAIN, LIST_MAIN_CHILD_QNAME_1, 2);
     private static final MapEntryNode LIST_MAIN_CHILD_3 = ImmutableNodes.mapEntry(LIST_MAIN, LIST_MAIN_CHILD_QNAME_1, 3);
     private static final Integer SIZE = 3;
-    private static final YangInstanceIdentifier.NodeWithValue BAR_PATH = new YangInstanceIdentifier
-            .NodeWithValue(LEAF_LIST_MAIN, "bar");
+    private static final NodeWithValue BAR_PATH = new NodeWithValue<>(LEAF_LIST_MAIN, "bar");
     private static final LeafSetEntryNode LEAF_SET_ENTRY_NODE = ImmutableLeafSetEntryNodeBuilder.create()
             .withNodeIdentifier(BAR_PATH)
             .withValue("bar")
@@ -102,7 +101,7 @@ public class BuilderTest {
 
     @Test
     public void immutableOrderedMapBuilderTest() {
-        final LinkedList<MapEntryNode> mapEntryNodeColl = new LinkedList();
+        final LinkedList<MapEntryNode> mapEntryNodeColl = new LinkedList<>();
         mapEntryNodeColl.add(LIST_MAIN_CHILD_3);
         final Map<QName, Object> keys = new HashMap<>();
         keys.put(LIST_MAIN_CHILD_QNAME_1, 1);
@@ -140,38 +139,38 @@ public class BuilderTest {
 
     @Test
     public void immutableOrderedLeafSetNodeBuilderTest() {
-        final NormalizedNode orderedLeafSet = ImmutableOrderedLeafSetNodeBuilder.create()
+        final NormalizedNode<?, ?> orderedLeafSet = ImmutableOrderedLeafSetNodeBuilder.create()
                 .withNodeIdentifier(NODE_IDENTIFIER_LEAF_LIST)
                 .withChild(LEAF_SET_ENTRY_NODE)
                 .withChildValue("baz")
                 .removeChild(BAR_PATH)
                 .build();
-        final LinkedList<LeafSetNode> mapEntryNodeColl = new LinkedList();
-        mapEntryNodeColl.add((LeafSetNode)orderedLeafSet);
-        final UnmodifiableCollection leafSetCollection = (UnmodifiableCollection)orderedLeafSet.getValue();
-        final NormalizedNode orderedMapNodeSchemaAware = ImmutableOrderedLeafSetNodeSchemaAwareBuilder.create(leafList)
+        final LinkedList<LeafSetNode<?>> mapEntryNodeColl = new LinkedList<>();
+        mapEntryNodeColl.add((LeafSetNode<?>)orderedLeafSet);
+        final UnmodifiableCollection<?> leafSetCollection = (UnmodifiableCollection<?>)orderedLeafSet.getValue();
+        final NormalizedNode<?, ?> orderedMapNodeSchemaAware = ImmutableOrderedLeafSetNodeSchemaAwareBuilder.create(leafList)
                 .withChildValue("baz")
                 .build();
-        final UnmodifiableCollection SchemaAwareleafSetCollection = (UnmodifiableCollection)orderedMapNodeSchemaAware
+        final UnmodifiableCollection<?> SchemaAwareleafSetCollection = (UnmodifiableCollection<?>)orderedMapNodeSchemaAware
                 .getValue();
-        final NormalizedNode orderedLeafSetShemaAware = ImmutableOrderedLeafSetNodeSchemaAwareBuilder.create(leafList,
-                (LeafSetNode)orderedLeafSet)
+        final NormalizedNode<?, ?> orderedLeafSetShemaAware = ImmutableOrderedLeafSetNodeSchemaAwareBuilder.create(leafList,
+                (LeafSetNode<?>)orderedLeafSet)
                 .build();
 
         assertNotNull(Builders.orderedLeafSetBuilder(leafList));
         assertNotNull(Builders.anyXmlBuilder());
         assertNotNull(orderedLeafSetShemaAware.hashCode());
         assertNotNull(orderedLeafSetShemaAware);
-        assertEquals(1, ((OrderedLeafSetNode)orderedLeafSet).getSize());
-        assertEquals("baz", ((OrderedLeafSetNode)orderedLeafSet).getChild(0).getValue());
-        assertNotNull(((OrderedLeafSetNode)orderedLeafSet).getChild(BAR_PATH));
+        assertEquals(1, ((OrderedLeafSetNode<?>)orderedLeafSet).getSize());
+        assertEquals("baz", ((OrderedLeafSetNode<?>)orderedLeafSet).getChild(0).getValue());
+        assertNotNull(((OrderedLeafSetNode<?>)orderedLeafSet).getChild(BAR_PATH));
         assertEquals(1, leafSetCollection.size());
         assertEquals(1, SchemaAwareleafSetCollection.size());
     }
 
     @Test
     public void immutableMapNodeBuilderTest() {
-        final LinkedList<MapEntryNode> mapEntryNodeColl = new LinkedList();
+        final LinkedList<MapEntryNode> mapEntryNodeColl = new LinkedList<>();
         mapEntryNodeColl.add(LIST_MAIN_CHILD_3);
         final CollectionNodeBuilder<MapEntryNode, MapNode> collectionNodeBuilder = ImmutableMapNodeBuilder.create(1);
         assertNotNull(collectionNodeBuilder);
@@ -256,7 +255,7 @@ public class BuilderTest {
 
     @Test(expected=NullPointerException.class)
     public void immutableLeafSetNodeBuilderExceptionTest() {
-        final LeafSetNode leafSetNode = ImmutableLeafSetNodeBuilder.create(1).withNodeIdentifier(NODE_IDENTIFIER_LEAF_LIST)
+        final LeafSetNode<?> leafSetNode = ImmutableLeafSetNodeBuilder.create(1).withNodeIdentifier(NODE_IDENTIFIER_LEAF_LIST)
                 .build();
         assertNotNull(leafSetNode);
         ImmutableLeafSetNodeSchemaAwareBuilder.create(mock(LeafListSchemaNode.class), leafSetNode).build();
@@ -314,7 +313,7 @@ public class BuilderTest {
         ImmutableOrderedLeafSetNodeSchemaAwareBuilder.create(leafList).withNodeIdentifier(NODE_IDENTIFIER_LEAF_LIST).build();
     }
 
-    private static LeafSetNode getImmutableLeafSetNode() {
+    private static LeafSetNode<?> getImmutableLeafSetNode() {
         final ListNodeBuilder<Object, LeafSetEntryNode<Object>> leafSetBuilder = Builders.leafSetBuilder();
         leafSetBuilder.withNodeIdentifier(NODE_IDENTIFIER_LEAF_LIST);
         leafSetBuilder.addChild(LEAF_SET_ENTRY_NODE);
index ba960d05b70ff685d9735eff1fa86cc5a81c8bc7..2802a8ddd835aad4383c42c63446495d29983772 100644 (file)
@@ -11,7 +11,7 @@ package org.opendaylight.yangtools.yang.data.impl.schema.transform.dom.serialize
 import java.io.IOException;
 import java.text.ParseException;
 import org.junit.Test;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
 import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableLeafSetEntryNodeBuilder;
 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
@@ -23,7 +23,7 @@ import org.w3c.dom.Element;
 public class LeafSetDomSerializerTest {
     private LeafSetEntryNodeDomSerializer temp;
     private LeafListSchemaNode currentLeafList;
-    private LeafSetEntryNode tempLeafList;
+    private LeafSetEntryNode<?> tempLeafList;
 
     @Test
     public void leafSetDomSerializerTest() throws IOException, YangSyntaxErrorException, ParseException, ReactorException {
@@ -39,8 +39,7 @@ public class LeafSetDomSerializerTest {
         currentLeafList = (LeafListSchemaNode) currentContainer.getDataChildByName(DomSerializerTestUtils
                 .generateQname("first-leaf-list"));
 
-        final YangInstanceIdentifier.NodeWithValue barPath = new YangInstanceIdentifier.NodeWithValue
-                (DomSerializerTestUtils.generateQname("first-leaf-list"), "bar");
+        final NodeWithValue<?> barPath = new NodeWithValue<>(DomSerializerTestUtils.generateQname("first-leaf-list"), "bar");
         tempLeafList = ImmutableLeafSetEntryNodeBuilder.create()
                 .withNodeIdentifier(barPath)
                 .withValue("bar")
index 6e1c0a72e5ec73099ac24c78d617ea53ff9259de..751a79984e26e9e69fb7b3c4898e21570785fe4e 100644 (file)
@@ -59,7 +59,7 @@ public abstract class AbstractStringInstanceIdentifierCodec extends AbstractName
                 }
             } else if (arg instanceof NodeWithValue) {
                 sb.append("[.='");
-                sb.append(((NodeWithValue) arg).getValue());
+                sb.append(((NodeWithValue<?>) arg).getValue());
                 sb.append("']");
             }
         }
index c8dd12ca055e456a94f4ff893329c732332c3792..540c8720bb9dabcdedbdc22511719d89fdcbf9ea 100644 (file)
@@ -10,10 +10,10 @@ package org.opendaylight.yangtools.yang.data.util;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
 import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
 
-final class LeafListEntryContextNode extends AbstractLeafNodeContext<NodeWithValue> {
+final class LeafListEntryContextNode extends AbstractLeafNodeContext<NodeWithValue<?>> {
 
     public LeafListEntryContextNode(final LeafListSchemaNode potential) {
-        super(new NodeWithValue(potential.getQName(), null), potential);
+        super(new NodeWithValue<>(potential.getQName(), null), potential);
     }
 
     @Override
index 980f5f7c6741efbb965e6be230b850ee5e7b220f..fe5aaffee788e3809563d6f9ac68c4c49d19d617 100644 (file)
@@ -76,7 +76,7 @@ class XpathStringParsingPathArgumentBuilder implements Builder<Iterable<PathArgu
     private DataSchemaContextNode<?> current;
     private int offset;
 
-    XpathStringParsingPathArgumentBuilder(AbstractStringInstanceIdentifierCodec codec, String data) {
+    XpathStringParsingPathArgumentBuilder(final AbstractStringInstanceIdentifierCodec codec, final String data) {
         this.codec = Preconditions.checkNotNull(codec);
         this.data = Preconditions.checkNotNull(data);
         this.current = codec.getDataContextTree().getRoot();
@@ -106,7 +106,7 @@ class XpathStringParsingPathArgumentBuilder implements Builder<Iterable<PathArgu
     }
 
 
-    private DataSchemaContextNode<?> nextContextNode(QName name) {
+    private DataSchemaContextNode<?> nextContextNode(final QName name) {
         current = current.getChild(name);
         checkValid(current != null, "%s is not correct schema node identifier.",name);
         while (current.isMixin()) {
@@ -133,7 +133,7 @@ class XpathStringParsingPathArgumentBuilder implements Builder<Iterable<PathArgu
      * @param name QName of node, for which predicates are computed.
      * @return PathArgument representing node selection with predictes
      */
-    private PathArgument computeIdentifierWithPredicate(QName name) {
+    private PathArgument computeIdentifierWithPredicate(final QName name) {
         DataSchemaContextNode<?> currentNode = nextContextNode(name);
         checkValid(currentNode.isKeyedEntry(), "Entry %s does not allow specifying predicates.", name);
 
@@ -158,7 +158,7 @@ class XpathStringParsingPathArgumentBuilder implements Builder<Iterable<PathArgu
             // Break-out from method for leaf-list case
             if (key == null && currentNode.isLeaf()) {
                 checkValid(offset == data.length(), "Leaf argument must be last argument of instance identifier.");
-                return new YangInstanceIdentifier.NodeWithValue(name, keyValue);
+                return new YangInstanceIdentifier.NodeWithValue<>(name, keyValue);
             }
             final DataSchemaContextNode<?> keyNode = currentNode.getChild(key);
             checkValid(keyNode != null, "%s is not correct schema node identifier.", key);
@@ -169,7 +169,7 @@ class XpathStringParsingPathArgumentBuilder implements Builder<Iterable<PathArgu
     }
 
 
-    private PathArgument computeIdentifier(QName name) {
+    private PathArgument computeIdentifier(final QName name) {
         DataSchemaContextNode<?> currentNode = nextContextNode(name);
         checkValid(!currentNode.isKeyedEntry(), "Entry %s requires key or value predicate to be present", name);
         return currentNode.getIdentifier();
@@ -210,7 +210,7 @@ class XpathStringParsingPathArgumentBuilder implements Builder<Iterable<PathArgu
     }
 
 
-    private QName createQName(String prefix, String localName) {
+    private QName createQName(final String prefix, final String localName) {
         return codec.createQName(prefix, localName);
     }
 
@@ -221,7 +221,7 @@ class XpathStringParsingPathArgumentBuilder implements Builder<Iterable<PathArgu
      * @param expected Expected character
      * @param errorMsg Error message if {@link #currentChar()} does not match expected.
      */
-    private void checkCurrentAndSkip(char expected, String errorMsg) {
+    private void checkCurrentAndSkip(final char expected, final String errorMsg) {
         checkValid(expected == currentChar(), errorMsg);
         offset++;
     }
@@ -235,7 +235,7 @@ class XpathStringParsingPathArgumentBuilder implements Builder<Iterable<PathArgu
      * @param value Value to be checked and deserialized
      * @return Object representing value in yang-data-api format.
      */
-    private Object deserializeValue(@Nullable QName key, String value) {
+    private Object deserializeValue(@Nullable final QName key, final String value) {
         // FIXME: Use codec to deserialize value to correct Java type
         return value;
     }
@@ -251,7 +251,7 @@ class XpathStringParsingPathArgumentBuilder implements Builder<Iterable<PathArgu
      * @param errorMsg Error message which will be provided to user.
      * @param attributes
      */
-    private void checkValid(boolean condition, String errorMsg, Object... attributes) {
+    private void checkValid(final boolean condition, final String errorMsg, final Object... attributes) {
         Preconditions.checkArgument(condition, "Could not parse Instance Identifier '%s'. Offset: %s : Reason: %s",
                 data,
                 offset,
@@ -314,13 +314,13 @@ class XpathStringParsingPathArgumentBuilder implements Builder<Iterable<PathArgu
         return data.substring(start, offset);
     }
 
-    private void nextSequenceEnd(CharMatcher matcher) {
+    private void nextSequenceEnd(final CharMatcher matcher) {
         while (!allCharactersConsumed() && matcher.matches(data.charAt(offset))) {
             offset++;
         }
     }
 
-    private void checkValidQuotation(char quoteChar) {
+    private void checkValidQuotation(final char quoteChar) {
         checkValid(
                 SQUOTE.matches(quoteChar) || DQUOTE.matches(quoteChar),
                 "Value must be qoute escaped with ''' or '\"'.");
index 951488e68ef758b5f40b0a90b4d725cc62c9cbbd..a3d5a6c34b7da59b598103ac426126b101f4623b 100644 (file)
@@ -8,7 +8,6 @@
 package org.opendaylight.yangtools.yang.model.export.test;
 
 import static org.junit.Assert.assertNotNull;
-
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.OutputStream;
@@ -29,7 +28,7 @@ public class Bug4504Test {
         }
     }
 
-    private File exportModule(final SchemaContext schemaContext, final Module module, final File outDir)
+    private static File exportModule(final SchemaContext schemaContext, final Module module, final File outDir)
             throws Exception {
         final File outFile = new File(outDir, YinExportUtils.wellFormedYinName(module.getName(), module.getRevision()));
         try (OutputStream output = new FileOutputStream(outFile)) {
index 546741aa9ce378fc434439d279e1458cba626a9e..cd55369d127ecac6b5d9ec9b75195abc0e4626bd 100644 (file)
@@ -87,7 +87,7 @@ public class SimpleModuleTest {
         }
     }
 
-    private File exportModule(final SchemaContext schemaContext, final Module module, final File outDir)
+    private static File exportModule(final SchemaContext schemaContext, final Module module, final File outDir)
             throws Exception {
         final File outFile = new File(outDir, YinExportUtils.wellFormedYinName(module.getName(), module.getRevision()));
         try (OutputStream output = new FileOutputStream(outFile)) {
index 2202eeb22b988f3aceba6b0372e23bb245e93aa5..5206be2f619008113bef40f487217470892c34c8 100644 (file)
@@ -511,4 +511,4 @@ public class TypeTest {
         final TypeDefinition<?> typeDefinition = concreteTypeBuilder.buildType();
         assertEquals(typeDefinition.getBaseType(), derivedTypeDef.getBaseType());
     }
-}
\ No newline at end of file
+}
index 4bc14b46f711169cd5b874077a17dbfc10123c0a..7c2bc71dbeb960bcf13fb80ef1255660b1548fde 100644 (file)
@@ -30,7 +30,7 @@ abstract class AbstractConstraintEffectiveStatement<A, D extends DeclaredStateme
     private final String errorMessage;
     private final A constraints;
 
-    public AbstractConstraintEffectiveStatement(final StmtContext<A, D, ?> ctx, ConstraintFactory<A> constraintFactory) {
+    public AbstractConstraintEffectiveStatement(final StmtContext<A, D, ?> ctx, final ConstraintFactory<A> constraintFactory) {
         super(ctx);
         String descriptionInit = null;
         String referenceInit = null;
@@ -92,7 +92,7 @@ abstract class ConstraintFactory<A> {
 
 abstract class ListConstraintFactory<A> extends ConstraintFactory<List<A>> {
     @Override
-    protected List<A> createConstraints(AbstractConstraintEffectiveStatement<List<A>, ?> stmt, List<A> argument) {
+    protected List<A> createConstraints(final AbstractConstraintEffectiveStatement<List<A>, ?> stmt, final List<A> argument) {
         if (!stmt.isCustomizedStatement()) {
             return ImmutableList.copyOf(argument);
         }
@@ -109,8 +109,8 @@ abstract class ListConstraintFactory<A> extends ConstraintFactory<List<A>> {
 
 final class LengthConstraintFactory extends ListConstraintFactory<LengthConstraint> {
     @Override
-    protected LengthConstraint createCustomizedConstraint(LengthConstraint lengthConstraint,
-            AbstractConstraintEffectiveStatement<List<LengthConstraint>, ?> stmt) {
+    protected LengthConstraint createCustomizedConstraint(final LengthConstraint lengthConstraint,
+            final AbstractConstraintEffectiveStatement<List<LengthConstraint>, ?> stmt) {
         return new LengthConstraintEffectiveImpl(lengthConstraint.getMin(), lengthConstraint.getMax(),
                 stmt.getDescription(), stmt.getReference(), stmt.getErrorAppTag(), stmt.getErrorMessage());
     }
@@ -118,8 +118,8 @@ final class LengthConstraintFactory extends ListConstraintFactory<LengthConstrai
 
 final class RangeConstraintFactory extends ListConstraintFactory<RangeConstraint> {
     @Override
-    protected RangeConstraint createCustomizedConstraint(RangeConstraint rangeConstraint,
-            AbstractConstraintEffectiveStatement<List<RangeConstraint>, ?> stmt) {
+    protected RangeConstraint createCustomizedConstraint(final RangeConstraint rangeConstraint,
+            final AbstractConstraintEffectiveStatement<List<RangeConstraint>, ?> stmt) {
         return new RangeConstraintEffectiveImpl(rangeConstraint.getMin(), rangeConstraint.getMax(),
                 stmt.getDescription(), stmt.getReference(), stmt.getErrorAppTag(), stmt.getErrorMessage());
     }
@@ -127,7 +127,7 @@ final class RangeConstraintFactory extends ListConstraintFactory<RangeConstraint
 
 final class PatternConstraintFactory extends ConstraintFactory<PatternConstraint> {
     @Override
-    protected PatternConstraint createConstraints(AbstractConstraintEffectiveStatement<PatternConstraint, ?> stmt, PatternConstraint argument) {
+    protected PatternConstraint createConstraints(final AbstractConstraintEffectiveStatement<PatternConstraint, ?> stmt, final PatternConstraint argument) {
         if (!stmt.isCustomizedStatement()) {
             return argument;
         } else {
@@ -135,8 +135,8 @@ final class PatternConstraintFactory extends ConstraintFactory<PatternConstraint
         }
     }
 
-    private PatternConstraint createCustomizedConstraint(PatternConstraint patternConstraint,
-            AbstractConstraintEffectiveStatement<?, ?> stmt) {
+    private static PatternConstraint createCustomizedConstraint(final PatternConstraint patternConstraint,
+            final AbstractConstraintEffectiveStatement<?, ?> stmt) {
         return new PatternConstraintEffectiveImpl(patternConstraint.getRegularExpression(), stmt.getDescription(),
                 stmt.getReference(), stmt.getErrorAppTag(), stmt.getErrorMessage());
     }
index 18b6fa72cf3d9c43a05890d5b2e1e7cec069820f..2f6b63ebb8420c459626bd53ec974b2b6a638a58 100644 (file)
@@ -12,7 +12,6 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
-
 import com.google.common.collect.Lists;
 import com.google.common.util.concurrent.CheckedFuture;
 import java.util.HashSet;
@@ -157,14 +156,14 @@ public class SharedSchemaRepositoryWithFeaturesTest {
         assertNotNull(testLeafC);
     }
 
-    private SettableSchemaProvider<ASTSchemaSource> getImmediateYangSourceProviderFromResource(
+    private static SettableSchemaProvider<ASTSchemaSource> getImmediateYangSourceProviderFromResource(
             final String resourceName) throws Exception {
         final ResourceYangSource yangSource = new ResourceYangSource(resourceName);
         final CheckedFuture<ASTSchemaSource, SchemaSourceException> aSTSchemaSource = TextToASTTransformer.TRANSFORMATION.apply(yangSource);
         return SettableSchemaProvider.createImmediate(aSTSchemaSource.get(), ASTSchemaSource.class);
     }
 
-    private void assertSchemaContext(final SchemaContext schemaContext, final int moduleSize) {
+    private static void assertSchemaContext(final SchemaContext schemaContext, final int moduleSize) {
         assertNotNull(schemaContext);
         assertEquals(moduleSize, schemaContext.getModules().size());
     }
index 0441cca3980f36148a517f196b7799219375b12d..1ce5dc397fca0f3de6e0c281acc368f7d2f1147f 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
-
 import java.io.FileNotFoundException;
 import java.net.URI;
 import java.net.URISyntaxException;
@@ -56,7 +55,6 @@ public class Bug3874ExtensionTest {
             assertEquals(1, unknownSchemaNodes.size());
 
             UnknownSchemaNode next = unknownSchemaNodes.iterator().next();
-            assertTrue(next instanceof UnknownSchemaNode);
             assertTrue(next instanceof AnyxmlSchemaLocationEffectiveStatementImpl);
             AnyxmlSchemaLocationEffectiveStatementImpl anyxmlSchemaLocationUnknownNode= (AnyxmlSchemaLocationEffectiveStatementImpl) next;
             assertEquals(SupportedExtensionsMapping.ANYXML_SCHEMA_LOCATION.getStatementName(), anyxmlSchemaLocationUnknownNode.getNodeType());
index 2c189753f94ace866c7653d2b95eb5bc13aa5245..1bdba2f48c481a82d8799d834d837e80076e790f 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
-
 import java.net.URI;
 import java.util.Date;
 import org.junit.Test;
@@ -64,7 +63,7 @@ public class Bug4610Test {
 
     }
 
-    private ContainerEffectiveStatementImpl findContainer(SchemaContext context, QName... path) {
+    private static ContainerEffectiveStatementImpl findContainer(final SchemaContext context, final QName... path) {
         SchemaNode node = SchemaContextUtil.findDataSchemaNode(context, SchemaPath.create(true, path));
         assertTrue(node instanceof ContainerEffectiveStatementImpl);
         ContainerEffectiveStatementImpl container = (ContainerEffectiveStatementImpl) node;
index 71f6a89ffaa9b51e5cefeb6da76eb874675bb8a1..27c0a81a33120b65598df140d072fbdde69644e2 100644 (file)
@@ -12,7 +12,6 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
-
 import java.io.FileNotFoundException;
 import java.net.URISyntaxException;
 import org.junit.Test;
@@ -37,7 +36,7 @@ public class Bug5481 {
         verifyExtendedLeaf(topContainer);
     }
 
-    private ContainerSchemaNode verifyTopContainer(SchemaContext context) {
+    private static ContainerSchemaNode verifyTopContainer(final SchemaContext context) {
         QName top = QName.create("http://example.com/module1", "2016-03-09", "top");
         DataSchemaNode dataChildByName = context.getDataChildByName(top);
         assertTrue(dataChildByName instanceof ContainerSchemaNode);
@@ -52,7 +51,7 @@ public class Bug5481 {
         return topContainer;
     }
 
-    private void verifyExtendedLeaf(ContainerSchemaNode topContainer) {
+    private static void verifyExtendedLeaf(final ContainerSchemaNode topContainer) {
         DataSchemaNode dataChildByName2 = topContainer.getDataChildByName(QName.create("http://example.com/module2",
                 "2016-03-09", "extended-leaf"));
         assertTrue(dataChildByName2 instanceof LeafSchemaNode);
index 46a9914a62c0ed25ff04fd1e624b7b21ebacfaf2..99566f8d0dd4561bbc8e91ed4e1cb9c7481ea761 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
-
 import java.io.FileNotFoundException;
 import java.net.URISyntaxException;
 import org.junit.Test;
@@ -35,7 +34,7 @@ public class Bug5712Test {
         checkThing2TypeDef(badModule);
     }
 
-    private void checkThing2TypeDef(Module badModule) {
+    private static void checkThing2TypeDef(final Module badModule) {
         TypeDefinition<?> thing2 = null;
         for (TypeDefinition<?> typeDef : badModule.getTypeDefinitions()) {
             if (typeDef.getQName().getLocalName().equals("thing2")) {
index 01c44391d570053942492bd369343e0dc5baa269..797b65c2537eff0b759aeea4f26fad2299a8af19 100644 (file)
@@ -130,13 +130,13 @@ public class TypesResolutionTest {
         List<TypeDefinition<?>> unionTypes = baseType.getTypes();
 
         StringTypeDefinition ipv4 = (StringTypeDefinition) unionTypes.get(0);
-        assertTrue(ipv4.getBaseType() instanceof StringTypeDefinition);
+        assertNotNull(ipv4.getBaseType());
         String expectedPattern = "^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}"
                 + "([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])" + "(%[\\p{N}\\p{L}]+)?$";
         assertEquals(expectedPattern, ipv4.getPatternConstraints().get(0).getRegularExpression());
 
         StringTypeDefinition ipv6 = (StringTypeDefinition) unionTypes.get(1);
-        assertTrue(ipv6.getBaseType() instanceof StringTypeDefinition);
+        assertNotNull(ipv6.getBaseType());
         List<PatternConstraint> ipv6Patterns = ipv6.getPatternConstraints();
         expectedPattern = "^((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}"
                 + "((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|" + "(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}"
@@ -153,7 +153,7 @@ public class TypesResolutionTest {
         Module tested = TestUtils.findModule(testedModules, "ietf-inet-types");
         Set<TypeDefinition<?>> typedefs = tested.getTypeDefinitions();
         StringTypeDefinition type = (StringTypeDefinition) TestUtils.findTypedef(typedefs, "domain-name");
-        assertTrue(type.getBaseType() instanceof StringTypeDefinition);
+        assertNotNull(type.getBaseType());
         List<PatternConstraint> patterns = type.getPatternConstraints();
         assertEquals(1, patterns.size());
         String expectedPattern = "^((([a-zA-Z0-9_]([a-zA-Z0-9\\-_]){0,61})?[a-zA-Z0-9]\\.)*"