Fix warnings around SimpleRpcListener 90/92390/12
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 2 Sep 2020 17:08:44 +0000 (19:08 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Fri, 18 Sep 2020 05:58:41 +0000 (07:58 +0200)
SimpleRpcListener has generic arguments, fix warnings pointing out
unparameterized use.

Change-Id: Ia0a4bd398eddb81bfac1e6459249be685e95d931
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
openflowjava/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/connection/AbstractConnectionAdapter.java
openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/connection/ChannelOutboundQueueTest.java
openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/connection/MessageListenerWrapperTest.java
openflowjava/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/connection/SimpleRpcListenerTest.java

index e32013396c631e843ae260c1bcb627e2c68f5c84..8a6520dfe77ac6e1fe8fc009b371cdc179d71eba 100644 (file)
@@ -295,8 +295,7 @@ abstract class AbstractConnectionAdapter implements ConnectionAdapter {
      */
     protected <O extends DataObject> ListenableFuture<RpcResult<O>> sendToSwitchFuture(final Object input,
                                                                                      final String failureInfo) {
-        SimpleRpcListener<O> listener = new SimpleRpcListener(input, failureInfo);
-        return enqueueMessage(listener);
+        return enqueueMessage(new SimpleRpcListener<>(input, failureInfo));
     }
 
     private <T> ListenableFuture<RpcResult<T>> enqueueMessage(final AbstractRpcListener<T> promise) {
index 56e33e7c4f63532fb37bb4d7abb6f5fb5d9dd14b..d36dd3b69e8157f456fb36972bf0e1f6e7244b3c 100644 (file)
@@ -5,7 +5,6 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.openflowjava.protocol.impl.core.connection;
 
 import io.netty.channel.Channel;
@@ -45,9 +44,9 @@ public class ChannelOutboundQueueTest {
     public void testEnqueue() {
         ChannelOutboundQueue queue = new ChannelOutboundQueue(channel, 1, null);
         boolean enqueued;
-        enqueued = queue.enqueue(new SimpleRpcListener("INPUT", "Failed to send INPUT"));
+        enqueued = queue.enqueue(new SimpleRpcListener<>("INPUT", "Failed to send INPUT"));
         Assert.assertTrue("Enqueue problem", enqueued);
-        enqueued = queue.enqueue(new SimpleRpcListener("INPUT", "Failed to send INPUT"));
+        enqueued = queue.enqueue(new SimpleRpcListener<>("INPUT", "Failed to send INPUT"));
         Assert.assertFalse("Enqueue problem", enqueued);
     }
 }
index 155af98d8302f82defb9cf3b9609c7a30c091f7e..aa92f6b4f9922e65d1640bb6e7942a59ec6737fd 100644 (file)
@@ -5,7 +5,6 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.openflowjava.protocol.impl.core.connection;
 
 import org.junit.Assert;
@@ -14,7 +13,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInputBuilder;
 
 /**
- * UNit tests for MessageListenerWrapper.
+ * Unit tests for MessageListenerWrapper.
  *
  * @author michal.polkorab
  */
@@ -27,7 +26,7 @@ public class MessageListenerWrapperTest {
     public void test() {
         HelloInputBuilder builder = new HelloInputBuilder();
         HelloInput hello = builder.build();
-        SimpleRpcListener listener = new SimpleRpcListener(hello, "Error");
+        SimpleRpcListener<?> listener = new SimpleRpcListener<>(hello, "Error");
         MessageListenerWrapper wrapper = new MessageListenerWrapper(hello, listener);
         Assert.assertEquals("Wrong message", hello, wrapper.getMsg());
         Assert.assertEquals("Wrong listener", listener, wrapper.getListener());
index 11da2f0dd9cc94395d58d98fb1d5e5de48b9077f..7bd1473ba927b66caa74334277a1adcb6bd74b50 100644 (file)
@@ -5,7 +5,6 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.openflowjava.protocol.impl.core.connection;
 
 import static org.junit.Assert.fail;
@@ -46,7 +45,7 @@ public class SimpleRpcListenerTest {
      */
     @Test
     public void test() {
-        SimpleRpcListener listener = new SimpleRpcListener("MESSAGE", "Failed to send message");
+        SimpleRpcListener<?> listener = new SimpleRpcListener<>("MESSAGE", "Failed to send message");
         Assert.assertEquals("Wrong message", "MESSAGE", listener.takeMessage());
         Assert.assertEquals("Wrong message", listener, listener.takeListener());
     }
@@ -56,7 +55,7 @@ public class SimpleRpcListenerTest {
      */
     @Test
     public void testSuccessfulRpc() {
-        SimpleRpcListener<?> listener = new SimpleRpcListener("MESSAGE", "Failed to send message");
+        SimpleRpcListener<?> listener = new SimpleRpcListener<>("MESSAGE", "Failed to send message");
         listener.operationSuccessful();
         SettableFuture<RpcResult<?>> result = SettableFuture.create();
         result.set(RpcResultBuilder.success((Void)null).build());
@@ -75,7 +74,7 @@ public class SimpleRpcListenerTest {
     @Test
     public void testOperationComplete() {
         when(future.isSuccess()).thenReturn(false);
-        SimpleRpcListener<?> listener = new SimpleRpcListener("MESSAGE", "Failed to send message");
+        SimpleRpcListener<?> listener = new SimpleRpcListener<>("MESSAGE", "Failed to send message");
         listener.operationComplete(future);
         verify(future, times(1)).cause();
         try {
@@ -91,7 +90,7 @@ public class SimpleRpcListenerTest {
     @Test
     public void testOperationComplete2() {
         when(future.isSuccess()).thenReturn(true);
-        SimpleRpcListener<?> listener = new SimpleRpcListener("MESSAGE", "Failed to send message");
+        SimpleRpcListener<?> listener = new SimpleRpcListener<>("MESSAGE", "Failed to send message");
         listener.operationComplete(future);
         verify(future, times(0)).cause();
         try {