Add cast to help compiler to build (#11587)

Motivation:

Sometimes intellij fails to build because the compiler cant really figure out what to do. We can workaround this by adding some explicit casts.

Modifications:

Add explicits casts

Result:

No more problems with intellij
This commit is contained in:
Norman Maurer 2021-08-18 09:21:19 +02:00 committed by GitHub
parent 794c45fd59
commit 69f0de223f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 21 additions and 22 deletions

View File

@ -43,7 +43,6 @@ public class TcpDnsTest {
DnsQuery readQuery = channel.readInbound(); DnsQuery readQuery = channel.readInbound();
assertThat(readQuery, is(query)); assertThat(readQuery, is(query));
assertThat(readQuery.recordAt(DnsSection.QUESTION), is(query.recordAt(DnsSection.QUESTION)));
assertThat(readQuery.recordAt(DnsSection.QUESTION).name(), is(query.recordAt(DnsSection.QUESTION).name())); assertThat(readQuery.recordAt(DnsSection.QUESTION).name(), is(query.recordAt(DnsSection.QUESTION).name()));
assertFalse(channel.finish()); assertFalse(channel.finish());
} }

View File

@ -76,7 +76,7 @@ public class ByteToMessageCodecTest {
assertTrue(ch.writeInbound(buffer)); assertTrue(ch.writeInbound(buffer));
ch.pipeline().remove(codec); ch.pipeline().remove(codec);
assertTrue(ch.finish()); assertTrue(ch.finish());
assertEquals(1, ch.readInbound()); assertEquals(1, (Integer) ch.readInbound());
ByteBuf buf = ch.readInbound(); ByteBuf buf = ch.readInbound();
assertEquals(Unpooled.wrappedBuffer(new byte[]{'0'}), buf); assertEquals(Unpooled.wrappedBuffer(new byte[]{'0'}), buf);

View File

@ -502,10 +502,10 @@ public class ByteToMessageDecoderTest {
}; };
EmbeddedChannel channel = new EmbeddedChannel(decoder); EmbeddedChannel channel = new EmbeddedChannel(decoder);
assertTrue(channel.writeInbound(Unpooled.wrappedBuffer(new byte[]{1, 2, 3, 4, 5}))); assertTrue(channel.writeInbound(Unpooled.wrappedBuffer(new byte[]{1, 2, 3, 4, 5})));
assertEquals((byte) 1, channel.readInbound()); assertEquals((byte) 1, (Byte) channel.readInbound());
assertEquals((byte) 2, channel.readInbound()); assertEquals((byte) 2, (Byte) channel.readInbound());
assertEquals((byte) 3, channel.readInbound()); assertEquals((byte) 3, (Byte) channel.readInbound());
assertEquals((byte) 4, channel.readInbound()); assertEquals((byte) 4, (Byte) channel.readInbound());
ByteBuf buffer5 = channel.readInbound(); ByteBuf buffer5 = channel.readInbound();
assertEquals((byte) 5, buffer5.readByte()); assertEquals((byte) 5, buffer5.readByte());
assertFalse(buffer5.isReadable()); assertFalse(buffer5.isReadable());

View File

@ -92,8 +92,8 @@ public class FlushConsolidationHandlerTest {
channel.flush(); channel.flush();
channel.runPendingTasks(); channel.runPendingTasks();
assertEquals(3, flushCount.get()); assertEquals(3, flushCount.get());
assertEquals(1L, channel.readOutbound()); assertEquals(1L, (Long) channel.readOutbound());
assertEquals(2L, channel.readOutbound()); assertEquals(2L, (Long) channel.readOutbound());
assertNull(channel.readOutbound()); assertNull(channel.readOutbound());
assertFalse(channel.finish()); assertFalse(channel.finish());
} }
@ -108,7 +108,7 @@ public class FlushConsolidationHandlerTest {
assertNull(channel.readOutbound()); assertNull(channel.readOutbound());
channel.close(); channel.close();
assertEquals(1, flushCount.get()); assertEquals(1, flushCount.get());
assertEquals(1L, channel.readOutbound()); assertEquals(1L, (Long) channel.readOutbound());
assertNull(channel.readOutbound()); assertNull(channel.readOutbound());
assertFalse(channel.finish()); assertFalse(channel.finish());
} }
@ -123,7 +123,7 @@ public class FlushConsolidationHandlerTest {
assertNull(channel.readOutbound()); assertNull(channel.readOutbound());
channel.disconnect(); channel.disconnect();
assertEquals(1, flushCount.get()); assertEquals(1, flushCount.get());
assertEquals(1L, channel.readOutbound()); assertEquals(1L, (Long) channel.readOutbound());
assertNull(channel.readOutbound()); assertNull(channel.readOutbound());
assertFalse(channel.finish()); assertFalse(channel.finish());
} }
@ -138,7 +138,7 @@ public class FlushConsolidationHandlerTest {
assertNull(channel.readOutbound()); assertNull(channel.readOutbound());
channel.pipeline().fireExceptionCaught(new IllegalStateException()); channel.pipeline().fireExceptionCaught(new IllegalStateException());
assertEquals(1, flushCount.get()); assertEquals(1, flushCount.get());
assertEquals(1L, channel.readOutbound()); assertEquals(1L, (Long) channel.readOutbound());
assertNull(channel.readOutbound()); assertNull(channel.readOutbound());
assertThrows(IllegalStateException.class, new Executable() { assertThrows(IllegalStateException.class, new Executable() {
@Override @Override
@ -158,7 +158,7 @@ public class FlushConsolidationHandlerTest {
assertNull(channel.readOutbound()); assertNull(channel.readOutbound());
channel.pipeline().remove(FlushConsolidationHandler.class); channel.pipeline().remove(FlushConsolidationHandler.class);
assertEquals(1, flushCount.get()); assertEquals(1, flushCount.get());
assertEquals(1L, channel.readOutbound()); assertEquals(1L, (Long) channel.readOutbound());
assertNull(channel.readOutbound()); assertNull(channel.readOutbound());
assertFalse(channel.finish()); assertFalse(channel.finish());
} }
@ -177,8 +177,8 @@ public class FlushConsolidationHandlerTest {
} }
}); });
channel.flushOutbound(); channel.flushOutbound();
assertEquals(1L, channel.readOutbound()); assertEquals(1L, (Long) channel.readOutbound());
assertEquals(1L, channel.readOutbound()); assertEquals(1L, (Long) channel.readOutbound());
assertNull(channel.readOutbound()); assertNull(channel.readOutbound());
assertFalse(channel.finish()); assertFalse(channel.finish());
} }

View File

@ -274,7 +274,7 @@ public class ChunkedWriteHandlerTest {
ch.writeAndFlush(input).syncUninterruptibly(); ch.writeAndFlush(input).syncUninterruptibly();
assertTrue(ch.finish()); assertTrue(ch.finish());
assertEquals(0, ch.readOutbound()); assertEquals(0, (Integer) ch.readOutbound());
assertNull(ch.readOutbound()); assertNull(ch.readOutbound());
} }

View File

@ -267,9 +267,9 @@ public class PendingWriteQueueTest {
assertTrue(promise3.isDone()); assertTrue(promise3.isDone());
assertTrue(promise3.isSuccess()); assertTrue(promise3.isSuccess());
assertTrue(channel.finish()); assertTrue(channel.finish());
assertEquals(1L, channel.readOutbound()); assertEquals(1L, (Long) channel.readOutbound());
assertEquals(2L, channel.readOutbound()); assertEquals(2L, (Long) channel.readOutbound());
assertEquals(3L, channel.readOutbound()); assertEquals(3L, (Long) channel.readOutbound());
} }
@Test @Test
@ -292,8 +292,8 @@ public class PendingWriteQueueTest {
assertTrue(channel.finish()); assertTrue(channel.finish());
assertTrue(promise.isDone()); assertTrue(promise.isDone());
assertTrue(promise.isSuccess()); assertTrue(promise.isSuccess());
assertEquals(1L, channel.readOutbound()); assertEquals(1L, (Long) channel.readOutbound());
assertEquals(2L, channel.readOutbound()); assertEquals(2L, (Long) channel.readOutbound());
} }
@Test @Test
@ -362,8 +362,8 @@ public class PendingWriteQueueTest {
assertTrue(promise2.isSuccess()); assertTrue(promise2.isSuccess());
assertTrue(channel.finish()); assertTrue(channel.finish());
assertEquals(1L, channel.readOutbound()); assertEquals(1L, (Long) channel.readOutbound());
assertEquals(2L, channel.readOutbound()); assertEquals(2L, (Long) channel.readOutbound());
assertNull(channel.readOutbound()); assertNull(channel.readOutbound());
assertNull(channel.readInbound()); assertNull(channel.readInbound());
} }