migrate java8 (#8779)

Motivation:

We can omit argument types when using Java8.

Modification:

Omit arguments where possible.

Result:

Cleaner code.
This commit is contained in:
田欧 2019-01-28 12:55:30 +08:00 committed by Norman Maurer
parent 7d3ad7d855
commit 934a07fbe2
43 changed files with 106 additions and 106 deletions

View File

@ -79,7 +79,7 @@ public final class HAProxyMessage {
String sourceAddress, String destinationAddress, int sourcePort, int destinationPort) { String sourceAddress, String destinationAddress, int sourcePort, int destinationPort) {
this(protocolVersion, command, proxiedProtocol, this(protocolVersion, command, proxiedProtocol,
sourceAddress, destinationAddress, sourcePort, destinationPort, Collections.<HAProxyTLV>emptyList()); sourceAddress, destinationAddress, sourcePort, destinationPort, Collections.emptyList());
} }
/** /**
@ -285,7 +285,7 @@ public final class HAProxyMessage {
return new HAProxySSLTLV(verify, client, encapsulatedTlvs, rawContent); return new HAProxySSLTLV(verify, client, encapsulatedTlvs, rawContent);
} }
return new HAProxySSLTLV(verify, client, Collections.<HAProxyTLV>emptyList(), rawContent); return new HAProxySSLTLV(verify, client, Collections.emptyList(), rawContent);
// If we're not dealing with a SSL Type, we can use the same mechanism // If we're not dealing with a SSL Type, we can use the same mechanism
case PP2_TYPE_ALPN: case PP2_TYPE_ALPN:
case PP2_TYPE_AUTHORITY: case PP2_TYPE_AUTHORITY:

View File

@ -31,7 +31,7 @@ public class HAProxySSLTLVTest {
// 0b0000_0111 // 0b0000_0111
final byte allClientsEnabled = 0x7; final byte allClientsEnabled = 0x7;
final HAProxySSLTLV allClientsEnabledTLV = final HAProxySSLTLV allClientsEnabledTLV =
new HAProxySSLTLV(0, allClientsEnabled, Collections.<HAProxyTLV>emptyList(), Unpooled.buffer()); new HAProxySSLTLV(0, allClientsEnabled, Collections.emptyList(), Unpooled.buffer());
assertTrue(allClientsEnabledTLV.isPP2ClientCertConn()); assertTrue(allClientsEnabledTLV.isPP2ClientCertConn());
assertTrue(allClientsEnabledTLV.isPP2ClientSSL()); assertTrue(allClientsEnabledTLV.isPP2ClientSSL());
@ -43,7 +43,7 @@ public class HAProxySSLTLVTest {
final byte clientSSLandClientCertSessEnabled = 0x5; final byte clientSSLandClientCertSessEnabled = 0x5;
final HAProxySSLTLV clientSSLandClientCertSessTLV = final HAProxySSLTLV clientSSLandClientCertSessTLV =
new HAProxySSLTLV(0, clientSSLandClientCertSessEnabled, Collections.<HAProxyTLV>emptyList(), new HAProxySSLTLV(0, clientSSLandClientCertSessEnabled, Collections.emptyList(),
Unpooled.buffer()); Unpooled.buffer());
assertFalse(clientSSLandClientCertSessTLV.isPP2ClientCertConn()); assertFalse(clientSSLandClientCertSessTLV.isPP2ClientCertConn());
@ -55,7 +55,7 @@ public class HAProxySSLTLVTest {
final byte noClientEnabled = 0x0; final byte noClientEnabled = 0x0;
final HAProxySSLTLV noClientTlv = final HAProxySSLTLV noClientTlv =
new HAProxySSLTLV(0, noClientEnabled, Collections.<HAProxyTLV>emptyList(), new HAProxySSLTLV(0, noClientEnabled, Collections.emptyList(),
Unpooled.buffer()); Unpooled.buffer());
assertFalse(noClientTlv.isPP2ClientCertConn()); assertFalse(noClientTlv.isPP2ClientCertConn());

View File

@ -60,7 +60,7 @@ public final class DeflateFrameClientExtensionHandshaker implements WebSocketCli
public WebSocketExtensionData newRequestData() { public WebSocketExtensionData newRequestData() {
return new WebSocketExtensionData( return new WebSocketExtensionData(
useWebkitExtensionName ? X_WEBKIT_DEFLATE_FRAME_EXTENSION : DEFLATE_FRAME_EXTENSION, useWebkitExtensionName ? X_WEBKIT_DEFLATE_FRAME_EXTENSION : DEFLATE_FRAME_EXTENSION,
Collections.<String, String>emptyMap()); Collections.emptyMap());
} }
@Override @Override

View File

@ -96,7 +96,7 @@ public final class DeflateFrameServerExtensionHandshaker implements WebSocketSer
@Override @Override
public WebSocketExtensionData newReponseData() { public WebSocketExtensionData newReponseData() {
return new WebSocketExtensionData(extensionName, Collections.<String, String>emptyMap()); return new WebSocketExtensionData(extensionName, Collections.emptyMap());
} }
} }

View File

@ -41,7 +41,7 @@ public class HttpServerUpgradeHandlerTest {
private class TestUpgradeCodec implements UpgradeCodec { private class TestUpgradeCodec implements UpgradeCodec {
@Override @Override
public Collection<CharSequence> requiredUpgradeHeaders() { public Collection<CharSequence> requiredUpgradeHeaders() {
return Collections.<CharSequence>emptyList(); return Collections.emptyList();
} }
@Override @Override

View File

@ -49,10 +49,10 @@ public class WebSocketClientExtensionHandlerTest {
public void testMainSuccess() { public void testMainSuccess() {
// initialize // initialize
when(mainHandshakerMock.newRequestData()). when(mainHandshakerMock.newRequestData()).
thenReturn(new WebSocketExtensionData("main", Collections.<String, String>emptyMap())); thenReturn(new WebSocketExtensionData("main", Collections.emptyMap()));
when(mainHandshakerMock.handshakeExtension(any(WebSocketExtensionData.class))).thenReturn(mainExtensionMock); when(mainHandshakerMock.handshakeExtension(any(WebSocketExtensionData.class))).thenReturn(mainExtensionMock);
when(fallbackHandshakerMock.newRequestData()). when(fallbackHandshakerMock.newRequestData()).
thenReturn(new WebSocketExtensionData("fallback", Collections.<String, String>emptyMap())); thenReturn(new WebSocketExtensionData("fallback", Collections.emptyMap()));
when(mainExtensionMock.rsv()).thenReturn(WebSocketExtension.RSV1); when(mainExtensionMock.rsv()).thenReturn(WebSocketExtension.RSV1);
when(mainExtensionMock.newExtensionEncoder()).thenReturn(new DummyEncoder()); when(mainExtensionMock.newExtensionEncoder()).thenReturn(new DummyEncoder());
when(mainExtensionMock.newExtensionDecoder()).thenReturn(new DummyDecoder()); when(mainExtensionMock.newExtensionDecoder()).thenReturn(new DummyDecoder());
@ -98,10 +98,10 @@ public class WebSocketClientExtensionHandlerTest {
public void testFallbackSuccess() { public void testFallbackSuccess() {
// initialize // initialize
when(mainHandshakerMock.newRequestData()). when(mainHandshakerMock.newRequestData()).
thenReturn(new WebSocketExtensionData("main", Collections.<String, String>emptyMap())); thenReturn(new WebSocketExtensionData("main", Collections.emptyMap()));
when(mainHandshakerMock.handshakeExtension(any(WebSocketExtensionData.class))).thenReturn(null); when(mainHandshakerMock.handshakeExtension(any(WebSocketExtensionData.class))).thenReturn(null);
when(fallbackHandshakerMock.newRequestData()). when(fallbackHandshakerMock.newRequestData()).
thenReturn(new WebSocketExtensionData("fallback", Collections.<String, String>emptyMap())); thenReturn(new WebSocketExtensionData("fallback", Collections.emptyMap()));
when(fallbackHandshakerMock.handshakeExtension( when(fallbackHandshakerMock.handshakeExtension(
any(WebSocketExtensionData.class))).thenReturn(fallbackExtensionMock); any(WebSocketExtensionData.class))).thenReturn(fallbackExtensionMock);
when(fallbackExtensionMock.rsv()).thenReturn(WebSocketExtension.RSV1); when(fallbackExtensionMock.rsv()).thenReturn(WebSocketExtension.RSV1);
@ -150,13 +150,13 @@ public class WebSocketClientExtensionHandlerTest {
public void testAllSuccess() { public void testAllSuccess() {
// initialize // initialize
when(mainHandshakerMock.newRequestData()). when(mainHandshakerMock.newRequestData()).
thenReturn(new WebSocketExtensionData("main", Collections.<String, String>emptyMap())); thenReturn(new WebSocketExtensionData("main", Collections.emptyMap()));
when(mainHandshakerMock.handshakeExtension( when(mainHandshakerMock.handshakeExtension(
webSocketExtensionDataMatcher("main"))).thenReturn(mainExtensionMock); webSocketExtensionDataMatcher("main"))).thenReturn(mainExtensionMock);
when(mainHandshakerMock.handshakeExtension( when(mainHandshakerMock.handshakeExtension(
webSocketExtensionDataMatcher("fallback"))).thenReturn(null); webSocketExtensionDataMatcher("fallback"))).thenReturn(null);
when(fallbackHandshakerMock.newRequestData()). when(fallbackHandshakerMock.newRequestData()).
thenReturn(new WebSocketExtensionData("fallback", Collections.<String, String>emptyMap())); thenReturn(new WebSocketExtensionData("fallback", Collections.emptyMap()));
when(fallbackHandshakerMock.handshakeExtension( when(fallbackHandshakerMock.handshakeExtension(
webSocketExtensionDataMatcher("main"))).thenReturn(null); webSocketExtensionDataMatcher("main"))).thenReturn(null);
when(fallbackHandshakerMock.handshakeExtension( when(fallbackHandshakerMock.handshakeExtension(
@ -222,13 +222,13 @@ public class WebSocketClientExtensionHandlerTest {
public void testIfMainAndFallbackUseRSV1WillFail() { public void testIfMainAndFallbackUseRSV1WillFail() {
// initialize // initialize
when(mainHandshakerMock.newRequestData()). when(mainHandshakerMock.newRequestData()).
thenReturn(new WebSocketExtensionData("main", Collections.<String, String>emptyMap())); thenReturn(new WebSocketExtensionData("main", Collections.emptyMap()));
when(mainHandshakerMock.handshakeExtension( when(mainHandshakerMock.handshakeExtension(
webSocketExtensionDataMatcher("main"))).thenReturn(mainExtensionMock); webSocketExtensionDataMatcher("main"))).thenReturn(mainExtensionMock);
when(mainHandshakerMock.handshakeExtension( when(mainHandshakerMock.handshakeExtension(
webSocketExtensionDataMatcher("fallback"))).thenReturn(null); webSocketExtensionDataMatcher("fallback"))).thenReturn(null);
when(fallbackHandshakerMock.newRequestData()). when(fallbackHandshakerMock.newRequestData()).
thenReturn(new WebSocketExtensionData("fallback", Collections.<String, String>emptyMap())); thenReturn(new WebSocketExtensionData("fallback", Collections.emptyMap()));
when(fallbackHandshakerMock.handshakeExtension( when(fallbackHandshakerMock.handshakeExtension(
webSocketExtensionDataMatcher("main"))).thenReturn(null); webSocketExtensionDataMatcher("main"))).thenReturn(null);
when(fallbackHandshakerMock.handshakeExtension( when(fallbackHandshakerMock.handshakeExtension(

View File

@ -55,7 +55,7 @@ public class WebSocketServerExtensionHandlerTest {
when(mainExtensionMock.rsv()).thenReturn(WebSocketExtension.RSV1); when(mainExtensionMock.rsv()).thenReturn(WebSocketExtension.RSV1);
when(mainExtensionMock.newReponseData()).thenReturn( when(mainExtensionMock.newReponseData()).thenReturn(
new WebSocketExtensionData("main", Collections.<String, String>emptyMap())); new WebSocketExtensionData("main", Collections.emptyMap()));
when(mainExtensionMock.newExtensionEncoder()).thenReturn(new DummyEncoder()); when(mainExtensionMock.newExtensionEncoder()).thenReturn(new DummyEncoder());
when(mainExtensionMock.newExtensionDecoder()).thenReturn(new DummyDecoder()); when(mainExtensionMock.newExtensionDecoder()).thenReturn(new DummyDecoder());
@ -108,13 +108,13 @@ public class WebSocketServerExtensionHandlerTest {
when(mainExtensionMock.rsv()).thenReturn(WebSocketExtension.RSV1); when(mainExtensionMock.rsv()).thenReturn(WebSocketExtension.RSV1);
when(mainExtensionMock.newReponseData()).thenReturn( when(mainExtensionMock.newReponseData()).thenReturn(
new WebSocketExtensionData("main", Collections.<String, String>emptyMap())); new WebSocketExtensionData("main", Collections.emptyMap()));
when(mainExtensionMock.newExtensionEncoder()).thenReturn(new DummyEncoder()); when(mainExtensionMock.newExtensionEncoder()).thenReturn(new DummyEncoder());
when(mainExtensionMock.newExtensionDecoder()).thenReturn(new DummyDecoder()); when(mainExtensionMock.newExtensionDecoder()).thenReturn(new DummyDecoder());
when(fallbackExtensionMock.rsv()).thenReturn(WebSocketExtension.RSV2); when(fallbackExtensionMock.rsv()).thenReturn(WebSocketExtension.RSV2);
when(fallbackExtensionMock.newReponseData()).thenReturn( when(fallbackExtensionMock.newReponseData()).thenReturn(
new WebSocketExtensionData("fallback", Collections.<String, String>emptyMap())); new WebSocketExtensionData("fallback", Collections.emptyMap()));
when(fallbackExtensionMock.newExtensionEncoder()).thenReturn(new Dummy2Encoder()); when(fallbackExtensionMock.newExtensionEncoder()).thenReturn(new Dummy2Encoder());
when(fallbackExtensionMock.newExtensionDecoder()).thenReturn(new Dummy2Decoder()); when(fallbackExtensionMock.newExtensionDecoder()).thenReturn(new Dummy2Decoder());

View File

@ -57,7 +57,7 @@ public class DeflateFrameClientExtensionHandshakerTest {
new DeflateFrameClientExtensionHandshaker(false); new DeflateFrameClientExtensionHandshaker(false);
WebSocketClientExtension extension = handshaker.handshakeExtension( WebSocketClientExtension extension = handshaker.handshakeExtension(
new WebSocketExtensionData(DEFLATE_FRAME_EXTENSION, Collections.<String, String>emptyMap())); new WebSocketExtensionData(DEFLATE_FRAME_EXTENSION, Collections.emptyMap()));
assertNotNull(extension); assertNotNull(extension);
assertEquals(WebSocketClientExtension.RSV1, extension.rsv()); assertEquals(WebSocketClientExtension.RSV1, extension.rsv());

View File

@ -37,7 +37,7 @@ public class DeflateFrameServerExtensionHandshakerTest {
// execute // execute
WebSocketServerExtension extension = handshaker.handshakeExtension( WebSocketServerExtension extension = handshaker.handshakeExtension(
new WebSocketExtensionData(DEFLATE_FRAME_EXTENSION, Collections.<String, String>emptyMap())); new WebSocketExtensionData(DEFLATE_FRAME_EXTENSION, Collections.emptyMap()));
// test // test
assertNotNull(extension); assertNotNull(extension);
@ -54,7 +54,7 @@ public class DeflateFrameServerExtensionHandshakerTest {
// execute // execute
WebSocketServerExtension extension = handshaker.handshakeExtension( WebSocketServerExtension extension = handshaker.handshakeExtension(
new WebSocketExtensionData(X_WEBKIT_DEFLATE_FRAME_EXTENSION, Collections.<String, String>emptyMap())); new WebSocketExtensionData(X_WEBKIT_DEFLATE_FRAME_EXTENSION, Collections.emptyMap()));
// test // test
assertNotNull(extension); assertNotNull(extension);

View File

@ -67,7 +67,7 @@ public class PerMessageDeflateClientExtensionHandshakerTest {
new PerMessageDeflateClientExtensionHandshaker(); new PerMessageDeflateClientExtensionHandshaker();
WebSocketClientExtension extension = handshaker.handshakeExtension( WebSocketClientExtension extension = handshaker.handshakeExtension(
new WebSocketExtensionData(PERMESSAGE_DEFLATE_EXTENSION, Collections.<String, String>emptyMap())); new WebSocketExtensionData(PERMESSAGE_DEFLATE_EXTENSION, Collections.emptyMap()));
assertNotNull(extension); assertNotNull(extension);
assertEquals(RSV1, extension.rsv()); assertEquals(RSV1, extension.rsv());

View File

@ -41,7 +41,7 @@ public class PerMessageDeflateServerExtensionHandshakerTest {
// execute // execute
extension = handshaker.handshakeExtension( extension = handshaker.handshakeExtension(
new WebSocketExtensionData(PERMESSAGE_DEFLATE_EXTENSION, Collections.<String, String>emptyMap())); new WebSocketExtensionData(PERMESSAGE_DEFLATE_EXTENSION, Collections.emptyMap()));
// test // test
assertNotNull(extension); assertNotNull(extension);
@ -62,7 +62,7 @@ public class PerMessageDeflateServerExtensionHandshakerTest {
// execute // execute
extension = handshaker.handshakeExtension( extension = handshaker.handshakeExtension(
new WebSocketExtensionData(PERMESSAGE_DEFLATE_EXTENSION, Collections.<String, String>emptyMap())); new WebSocketExtensionData(PERMESSAGE_DEFLATE_EXTENSION, Collections.emptyMap()));
// test // test
assertNotNull(extension); assertNotNull(extension);

View File

@ -33,7 +33,7 @@ public final class CharSequenceMap<V> extends DefaultHeaders<CharSequence, V, Ch
} }
public CharSequenceMap(boolean caseSensitive) { public CharSequenceMap(boolean caseSensitive) {
this(caseSensitive, UnsupportedValueConverter.<V>instance()); this(caseSensitive, UnsupportedValueConverter.instance());
} }
public CharSequenceMap(boolean caseSensitive, ValueConverter<V> valueConverter) { public CharSequenceMap(boolean caseSensitive, ValueConverter<V> valueConverter) {

View File

@ -171,7 +171,7 @@ final class HpackStaticTable {
int length = STATIC_TABLE.size(); int length = STATIC_TABLE.size();
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
CharSequenceMap<Integer> ret = new CharSequenceMap<>(true, CharSequenceMap<Integer> ret = new CharSequenceMap<>(true,
UnsupportedValueConverter.<Integer>instance(), length); UnsupportedValueConverter.instance(), length);
// Iterate through the static table in reverse order to // Iterate through the static table in reverse order to
// save the smallest index for a given name in the map. // save the smallest index for a given name in the map.
for (int index = length; index > 0; index--) { for (int index = length; index > 0; index--) {

View File

@ -101,7 +101,7 @@ public final class Http2StreamChannelBootstrap {
} }
public Future<Http2StreamChannel> open() { public Future<Http2StreamChannel> open() {
return open(channel.eventLoop().<Http2StreamChannel>newPromise()); return open(channel.eventLoop().newPromise());
} }
public Future<Http2StreamChannel> open(final Promise<Http2StreamChannel> promise) { public Future<Http2StreamChannel> open(final Promise<Http2StreamChannel> promise) {

View File

@ -423,7 +423,7 @@ public final class HttpConversionUtil {
private static CharSequenceMap<AsciiString> toLowercaseMap(Iterator<? extends CharSequence> valuesIter, private static CharSequenceMap<AsciiString> toLowercaseMap(Iterator<? extends CharSequence> valuesIter,
int arraySizeHint) { int arraySizeHint) {
UnsupportedValueConverter<AsciiString> valueConverter = UnsupportedValueConverter.<AsciiString>instance(); UnsupportedValueConverter<AsciiString> valueConverter = UnsupportedValueConverter.instance();
CharSequenceMap<AsciiString> result = new CharSequenceMap<>(true, valueConverter, arraySizeHint); CharSequenceMap<AsciiString> result = new CharSequenceMap<>(true, valueConverter, arraySizeHint);
while (valuesIter.hasNext()) { while (valuesIter.hasNext()) {

View File

@ -344,7 +344,7 @@ public class Http2ConnectionHandlerTest {
ByteBuf prefacePlusSome = addSettingsHeader(Unpooled.buffer().writeBytes(connectionPrefaceBuf())); ByteBuf prefacePlusSome = addSettingsHeader(Unpooled.buffer().writeBytes(connectionPrefaceBuf()));
handler.channelRead(ctx, prefacePlusSome); handler.channelRead(ctx, prefacePlusSome);
verify(decoder, atLeastOnce()).decodeFrame(any(ChannelHandlerContext.class), verify(decoder, atLeastOnce()).decodeFrame(any(ChannelHandlerContext.class),
any(ByteBuf.class), ArgumentMatchers.<List<Object>>any()); any(ByteBuf.class), ArgumentMatchers.any());
} }
@Test @Test
@ -356,7 +356,7 @@ public class Http2ConnectionHandlerTest {
ByteBuf preface = connectionPrefaceBuf(); ByteBuf preface = connectionPrefaceBuf();
handler.channelRead(ctx, preface); handler.channelRead(ctx, preface);
verify(decoder, never()).decodeFrame(any(ChannelHandlerContext.class), verify(decoder, never()).decodeFrame(any(ChannelHandlerContext.class),
any(ByteBuf.class), ArgumentMatchers.<List<Object>>any()); any(ByteBuf.class), ArgumentMatchers.any());
// Now remove and add the handler...this is setting up the test condition. // Now remove and add the handler...this is setting up the test condition.
handler.handlerRemoved(ctx); handler.handlerRemoved(ctx);
@ -365,7 +365,7 @@ public class Http2ConnectionHandlerTest {
// Now verify we can continue as normal, reading connection preface plus more. // Now verify we can continue as normal, reading connection preface plus more.
ByteBuf prefacePlusSome = addSettingsHeader(Unpooled.buffer().writeBytes(connectionPrefaceBuf())); ByteBuf prefacePlusSome = addSettingsHeader(Unpooled.buffer().writeBytes(connectionPrefaceBuf()));
handler.channelRead(ctx, prefacePlusSome); handler.channelRead(ctx, prefacePlusSome);
verify(decoder, atLeastOnce()).decodeFrame(eq(ctx), any(ByteBuf.class), ArgumentMatchers.<List<Object>>any()); verify(decoder, atLeastOnce()).decodeFrame(eq(ctx), any(ByteBuf.class), ArgumentMatchers.any());
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")

View File

@ -203,8 +203,8 @@ public class Http2MultiplexCodecTest {
assertEquals(headersFrame, inboundHandler.readInbound()); assertEquals(headersFrame, inboundHandler.readInbound());
assertEqualsAndRelease(dataFrame1, inboundHandler.<Http2Frame>readInbound()); assertEqualsAndRelease(dataFrame1, inboundHandler.readInbound());
assertEqualsAndRelease(dataFrame2, inboundHandler.<Http2Frame>readInbound()); assertEqualsAndRelease(dataFrame2, inboundHandler.readInbound());
assertNull(inboundHandler.readInbound()); assertNull(inboundHandler.readInbound());
} }
@ -952,7 +952,7 @@ public class Http2MultiplexCodecTest {
frameInboundWriter.writeInboundData(childChannel.stream().id(), bb("1"), 0, false); frameInboundWriter.writeInboundData(childChannel.stream().id(), bb("1"), 0, false);
assertEqualsAndRelease(dataFrame1, inboundHandler.<Http2Frame>readInbound()); assertEqualsAndRelease(dataFrame1, inboundHandler.readInbound());
// We want one item to be in the queue, and allow the numReads to be larger than 1. This will ensure that // We want one item to be in the queue, and allow the numReads to be larger than 1. This will ensure that
// when beginRead() is called the child channel is added to the readPending queue of the parent channel. // when beginRead() is called the child channel is added to the readPending queue of the parent channel.
@ -961,7 +961,7 @@ public class Http2MultiplexCodecTest {
numReads.set(2); numReads.set(2);
childChannel.read(); childChannel.read();
assertEqualsAndRelease(dataFrame2, inboundHandler.<Http2Frame>readInbound()); assertEqualsAndRelease(dataFrame2, inboundHandler.readInbound());
assertNull(inboundHandler.readInbound()); assertNull(inboundHandler.readInbound());
@ -969,14 +969,14 @@ public class Http2MultiplexCodecTest {
// notify of readComplete(). // notify of readComplete().
frameInboundWriter.writeInboundData(childChannel.stream().id(), bb("3"), 0, false); frameInboundWriter.writeInboundData(childChannel.stream().id(), bb("3"), 0, false);
assertEqualsAndRelease(dataFrame3, inboundHandler.<Http2Frame>readInbound()); assertEqualsAndRelease(dataFrame3, inboundHandler.readInbound());
frameInboundWriter.writeInboundData(childChannel.stream().id(), bb("4"), 0, false); frameInboundWriter.writeInboundData(childChannel.stream().id(), bb("4"), 0, false);
assertNull(inboundHandler.readInbound()); assertNull(inboundHandler.readInbound());
childChannel.read(); childChannel.read();
assertEqualsAndRelease(dataFrame4, inboundHandler.<Http2Frame>readInbound()); assertEqualsAndRelease(dataFrame4, inboundHandler.readInbound());
assertNull(inboundHandler.readInbound()); assertNull(inboundHandler.readInbound());

View File

@ -58,7 +58,7 @@ public class LastInboundHandler extends ChannelDuplexHandler {
} }
public LastInboundHandler() { public LastInboundHandler() {
this(LastInboundHandler.<ChannelHandlerContext>noopConsumer()); this(LastInboundHandler.noopConsumer());
} }
public LastInboundHandler(Consumer<ChannelHandlerContext> channelReadCompleteConsumer) { public LastInboundHandler(Consumer<ChannelHandlerContext> channelReadCompleteConsumer) {

View File

@ -56,7 +56,7 @@ public final class DefaultSmtpRequest implements SmtpRequest {
DefaultSmtpRequest(SmtpCommand command, List<CharSequence> parameters) { DefaultSmtpRequest(SmtpCommand command, List<CharSequence> parameters) {
this.command = ObjectUtil.checkNotNull(command, "command"); this.command = ObjectUtil.checkNotNull(command, "command");
this.parameters = parameters != null ? this.parameters = parameters != null ?
Collections.unmodifiableList(parameters) : Collections.<CharSequence>emptyList(); Collections.unmodifiableList(parameters) : Collections.emptyList();
} }
@Override @Override

View File

@ -36,7 +36,7 @@ public abstract class AbstractEventExecutor extends AbstractExecutorService impl
static final long DEFAULT_SHUTDOWN_QUIET_PERIOD = 2; static final long DEFAULT_SHUTDOWN_QUIET_PERIOD = 2;
static final long DEFAULT_SHUTDOWN_TIMEOUT = 15; static final long DEFAULT_SHUTDOWN_TIMEOUT = 15;
private final Collection<EventExecutor> selfCollection = Collections.<EventExecutor>singleton(this); private final Collection<EventExecutor> selfCollection = Collections.singleton(this);
@Override @Override
public EventExecutor next() { public EventExecutor next() {

View File

@ -137,7 +137,7 @@ public class SingleThreadEventExecutorTest {
@Override @Override
public void run() { public void run() {
try { try {
Set<Callable<Boolean>> set = Collections.<Callable<Boolean>>singleton(new Callable<Boolean>() { Set<Callable<Boolean>> set = Collections.singleton(new Callable<Boolean>() {
@Override @Override
public Boolean call() throws Exception { public Boolean call() throws Exception {
promise.setFailure(new AssertionError("Should never execute the Callable")); promise.setFailure(new AssertionError("Should never execute the Callable"));

View File

@ -84,21 +84,21 @@ public class Slf4JLoggerFactoryTest {
internalLogger.warn("{}", "warn"); internalLogger.warn("{}", "warn");
internalLogger.warn("{} {}", "warn1", "warn2"); internalLogger.warn("{} {}", "warn1", "warn2");
verify(logger, times(2)).log(ArgumentMatchers.<Marker>isNull(), eq(LocationAwareSlf4JLogger.FQCN), verify(logger, times(2)).log(ArgumentMatchers.isNull(), eq(LocationAwareSlf4JLogger.FQCN),
eq(LocationAwareLogger.DEBUG_INT), captor.capture(), any(Object[].class), eq(LocationAwareLogger.DEBUG_INT), captor.capture(), any(Object[].class),
ArgumentMatchers.<Throwable>isNull()); ArgumentMatchers.isNull());
verify(logger, times(2)).log(ArgumentMatchers.<Marker>isNull(), eq(LocationAwareSlf4JLogger.FQCN), verify(logger, times(2)).log(ArgumentMatchers.isNull(), eq(LocationAwareSlf4JLogger.FQCN),
eq(LocationAwareLogger.ERROR_INT), captor.capture(), any(Object[].class), eq(LocationAwareLogger.ERROR_INT), captor.capture(), any(Object[].class),
ArgumentMatchers.<Throwable>isNull()); ArgumentMatchers.isNull());
verify(logger, times(2)).log(ArgumentMatchers.<Marker>isNull(), eq(LocationAwareSlf4JLogger.FQCN), verify(logger, times(2)).log(ArgumentMatchers.isNull(), eq(LocationAwareSlf4JLogger.FQCN),
eq(LocationAwareLogger.INFO_INT), captor.capture(), any(Object[].class), eq(LocationAwareLogger.INFO_INT), captor.capture(), any(Object[].class),
ArgumentMatchers.<Throwable>isNull()); ArgumentMatchers.isNull());
verify(logger, times(2)).log(ArgumentMatchers.<Marker>isNull(), eq(LocationAwareSlf4JLogger.FQCN), verify(logger, times(2)).log(ArgumentMatchers.isNull(), eq(LocationAwareSlf4JLogger.FQCN),
eq(LocationAwareLogger.TRACE_INT), captor.capture(), any(Object[].class), eq(LocationAwareLogger.TRACE_INT), captor.capture(), any(Object[].class),
ArgumentMatchers.<Throwable>isNull()); ArgumentMatchers.isNull());
verify(logger, times(2)).log(ArgumentMatchers.<Marker>isNull(), eq(LocationAwareSlf4JLogger.FQCN), verify(logger, times(2)).log(ArgumentMatchers.isNull(), eq(LocationAwareSlf4JLogger.FQCN),
eq(LocationAwareLogger.WARN_INT), captor.capture(), any(Object[].class), eq(LocationAwareLogger.WARN_INT), captor.capture(), any(Object[].class),
ArgumentMatchers.<Throwable>isNull()); ArgumentMatchers.isNull());
Iterator<String> logMessages = captor.getAllValues().iterator(); Iterator<String> logMessages = captor.getAllValues().iterator();
assertEquals("debug", logMessages.next()); assertEquals("debug", logMessages.next());

View File

@ -147,7 +147,7 @@ abstract class ConscryptAlpnSslEngine extends JdkSslEngine {
try { try {
String protocol = Conscrypt.getApplicationProtocol(getWrappedEngine()); String protocol = Conscrypt.getApplicationProtocol(getWrappedEngine());
protocolSelector.select(protocol != null ? Collections.singletonList(protocol) protocolSelector.select(protocol != null ? Collections.singletonList(protocol)
: Collections.<String>emptyList()); : Collections.emptyList());
} catch (Throwable e) { } catch (Throwable e) {
throw toSSLHandshakeException(e); throw toSSLHandshakeException(e);
} }

View File

@ -315,7 +315,7 @@ public class ReferenceCountedOpenSslEngine extends SSLEngine implements Referenc
} }
} }
return ocspResponse == null ? return ocspResponse == null ?
Collections.<byte[]>emptyList() : Collections.singletonList(ocspResponse); Collections.emptyList() : Collections.singletonList(ocspResponse);
} }
}; };
engineMap = context.engineMap; engineMap = context.engineMap;

View File

@ -93,7 +93,7 @@ public class SniHandler extends AbstractSniHandler<SslContext> {
*/ */
@Override @Override
protected Future<SslContext> lookup(ChannelHandlerContext ctx, String hostname) throws Exception { protected Future<SslContext> lookup(ChannelHandlerContext ctx, String hostname) throws Exception {
return mapping.map(hostname, ctx.executor().<SslContext>newPromise()); return mapping.map(hostname, ctx.executor().newPromise());
} }
@Override @Override

View File

@ -1691,7 +1691,7 @@ public class SslHandler extends ByteToMessageDecoder implements ChannelOutboundH
throw new IllegalStateException(); throw new IllegalStateException();
} }
return renegotiate(ctx.executor().<Channel>newPromise()); return renegotiate(ctx.executor().newPromise());
} }
/** /**

View File

@ -85,7 +85,7 @@ public class SslErrorTest {
exceptions.add(new CertificateNotYetValidException()); exceptions.add(new CertificateNotYetValidException());
exceptions.add(new CertificateRevokedException( exceptions.add(new CertificateRevokedException(
new Date(), CRLReason.AA_COMPROMISE, new X500Principal(""), new Date(), CRLReason.AA_COMPROMISE, new X500Principal(""),
Collections.<String, Extension>emptyMap())); Collections.emptyMap()));
// Also use wrapped exceptions as this is what the JDK implementation of X509TrustManagerFactory is doing. // Also use wrapped exceptions as this is what the JDK implementation of X509TrustManagerFactory is doing.
exceptions.add(newCertificateException(CertPathValidatorException.BasicReason.EXPIRED)); exceptions.add(newCertificateException(CertPathValidatorException.BasicReason.EXPIRED));

View File

@ -740,7 +740,7 @@ public class SslHandlerTest {
throw error; throw error;
} }
assertThat(sslHandler.handshakeFuture().await().cause(), assertThat(sslHandler.handshakeFuture().await().cause(),
CoreMatchers.<Throwable>instanceOf(SSLException.class)); CoreMatchers.instanceOf(SSLException.class));
} finally { } finally {
if (cc != null) { if (cc != null) {
cc.close().syncUninterruptibly(); cc.close().syncUninterruptibly();
@ -812,7 +812,7 @@ public class SslHandlerTest {
cc = future.syncUninterruptibly().channel(); cc = future.syncUninterruptibly().channel();
Throwable cause = sslHandler.handshakeFuture().await().cause(); Throwable cause = sslHandler.handshakeFuture().await().cause();
assertThat(cause, CoreMatchers.<Throwable>instanceOf(SSLException.class)); assertThat(cause, CoreMatchers.instanceOf(SSLException.class));
assertThat(cause.getMessage(), containsString("timed out")); assertThat(cause.getMessage(), containsString("timed out"));
} finally { } finally {
if (cc != null) { if (cc != null) {

View File

@ -166,7 +166,7 @@ abstract class Cache<E> {
volatile ScheduledFuture<?> expirationFuture; volatile ScheduledFuture<?> expirationFuture;
Entries(String hostname) { Entries(String hostname) {
super(Collections.<E>emptyList()); super(Collections.emptyList());
this.hostname = hostname; this.hostname = hostname;
} }
@ -260,7 +260,7 @@ abstract class Cache<E> {
} }
boolean clearAndCancel() { boolean clearAndCancel() {
List<E> entries = getAndSet(Collections.<E>emptyList()); List<E> entries = getAndSet(Collections.emptyList());
if (entries.isEmpty()) { if (entries.isEmpty()) {
return false; return false;
} }

View File

@ -127,7 +127,7 @@ public class DefaultDnsCache implements DnsCache {
public List<? extends DnsCacheEntry> get(String hostname, DnsRecord[] additionals) { public List<? extends DnsCacheEntry> get(String hostname, DnsRecord[] additionals) {
checkNotNull(hostname, "hostname"); checkNotNull(hostname, "hostname");
if (!emptyAdditionals(additionals)) { if (!emptyAdditionals(additionals)) {
return Collections.<DnsCacheEntry>emptyList(); return Collections.emptyList();
} }
return resolveCache.get(appendDot(hostname)); return resolveCache.get(appendDot(hostname));

View File

@ -748,7 +748,7 @@ public class DnsNameResolver extends InetNameResolver {
if (content != null) { if (content != null) {
// Our current implementation does not support reloading the hosts file, // Our current implementation does not support reloading the hosts file,
// so use a fairly large TTL (1 day, i.e. 86400 seconds). // so use a fairly large TTL (1 day, i.e. 86400 seconds).
trySuccess(promise, Collections.<DnsRecord>singletonList( trySuccess(promise, Collections.singletonList(
new DefaultDnsRawRecord(hostname, type, 86400, content))); new DefaultDnsRawRecord(hostname, type, 86400, content)));
return promise; return promise;
} }

View File

@ -781,7 +781,7 @@ abstract class DnsResolveContext<T> {
} }
} }
return cnames != null? cnames : Collections.<String, String>emptyMap(); return cnames != null? cnames : Collections.emptyMap();
} }
private void tryToFinishResolve(final DnsServerAddressStream nameServerAddrStream, private void tryToFinishResolve(final DnsServerAddressStream nameServerAddrStream,

View File

@ -48,12 +48,12 @@ final class InflightNameResolver<T> implements NameResolver<T> {
@Override @Override
public Future<T> resolve(String inetHost) { public Future<T> resolve(String inetHost) {
return resolve(inetHost, executor.<T>newPromise()); return resolve(inetHost, executor.newPromise());
} }
@Override @Override
public Future<List<T>> resolveAll(String inetHost) { public Future<List<T>> resolveAll(String inetHost) {
return resolveAll(inetHost, executor.<List<T>>newPromise()); return resolveAll(inetHost, executor.newPromise());
} }
@Override @Override

View File

@ -44,7 +44,7 @@ public class DnsNameResolverClientSubnetTest {
// Same as: // Same as:
// # /.bind-9.9.3-edns/bin/dig @ns1.google.com www.google.es +client=157.88.0.0/24 // # /.bind-9.9.3-edns/bin/dig @ns1.google.com www.google.es +client=157.88.0.0/24
Future<List<InetAddress>> future = resolver.resolveAll("www.google.es", Future<List<InetAddress>> future = resolver.resolveAll("www.google.es",
Collections.<DnsRecord>singleton( Collections.singleton(
// Suggest max payload size of 1024 // Suggest max payload size of 1024
// 157.88.0.0 / 24 // 157.88.0.0 / 24
new DefaultDnsOptEcsRecord(1024, 24, new DefaultDnsOptEcsRecord(1024, 24,

View File

@ -404,7 +404,7 @@ public class DnsNameResolverTest {
case A: case A:
Map<String, Object> attr = new HashMap<>(); Map<String, Object> attr = new HashMap<>();
attr.put(DnsAttribute.IP_ADDRESS.toLowerCase(Locale.US), overriddenIP); attr.put(DnsAttribute.IP_ADDRESS.toLowerCase(Locale.US), overriddenIP);
return Collections.<ResourceRecord>singleton( return Collections.singleton(
new TestDnsServer.TestResourceRecord( new TestDnsServer.TestResourceRecord(
question.getDomainName(), question.getRecordType(), attr)); question.getDomainName(), question.getRecordType(), attr));
default: default:
@ -1037,8 +1037,8 @@ public class DnsNameResolverTest {
final List<DnsRecord> records = resolver.resolveAll(new DefaultDnsQuestion("foo.com.", A)) final List<DnsRecord> records = resolver.resolveAll(new DefaultDnsQuestion("foo.com.", A))
.syncUninterruptibly().getNow(); .syncUninterruptibly().getNow();
assertThat(records, Matchers.<DnsRecord>hasSize(1)); assertThat(records, Matchers.hasSize(1));
assertThat(records.get(0), Matchers.<DnsRecord>instanceOf(DnsRawRecord.class)); assertThat(records.get(0), Matchers.instanceOf(DnsRawRecord.class));
final DnsRawRecord record = (DnsRawRecord) records.get(0); final DnsRawRecord record = (DnsRawRecord) records.get(0);
final ByteBuf content = record.content(); final ByteBuf content = record.content();
@ -2098,7 +2098,7 @@ public class DnsNameResolverTest {
if (question.getDomainName().equals("cname.netty.io")) { if (question.getDomainName().equals("cname.netty.io")) {
Map<String, Object> map1 = new HashMap<>(); Map<String, Object> map1 = new HashMap<>();
map1.put(DnsAttribute.IP_ADDRESS.toLowerCase(), "10.0.0.99"); map1.put(DnsAttribute.IP_ADDRESS.toLowerCase(), "10.0.0.99");
return Collections.<ResourceRecord>singleton( return Collections.singleton(
new TestDnsServer.TestResourceRecord(question.getDomainName(), RecordType.A, map1)); new TestDnsServer.TestResourceRecord(question.getDomainName(), RecordType.A, map1));
} else { } else {
Set<ResourceRecord> records = new LinkedHashSet<>(2); Set<ResourceRecord> records = new LinkedHashSet<>(2);
@ -2148,19 +2148,19 @@ public class DnsNameResolverTest {
Set<ResourceRecord> records = new LinkedHashSet<>(4); Set<ResourceRecord> records = new LinkedHashSet<>(4);
records.add(new TestDnsServer.TestResourceRecord("x." + question.getDomainName(), records.add(new TestDnsServer.TestResourceRecord("x." + question.getDomainName(),
RecordType.A, Collections.<String, Object>singletonMap( RecordType.A, Collections.singletonMap(
DnsAttribute.IP_ADDRESS.toLowerCase(), "10.0.0.99"))); DnsAttribute.IP_ADDRESS.toLowerCase(), "10.0.0.99")));
records.add(new TestDnsServer.TestResourceRecord( records.add(new TestDnsServer.TestResourceRecord(
"cname2.netty.io", RecordType.CNAME, "cname2.netty.io", RecordType.CNAME,
Collections.<String, Object>singletonMap( Collections.singletonMap(
DnsAttribute.DOMAIN_NAME.toLowerCase(), "cname.netty.io"))); DnsAttribute.DOMAIN_NAME.toLowerCase(), "cname.netty.io")));
records.add(new TestDnsServer.TestResourceRecord( records.add(new TestDnsServer.TestResourceRecord(
"cname.netty.io", RecordType.CNAME, "cname.netty.io", RecordType.CNAME,
Collections.<String, Object>singletonMap( Collections.singletonMap(
DnsAttribute.DOMAIN_NAME.toLowerCase(), "cname2.netty.io"))); DnsAttribute.DOMAIN_NAME.toLowerCase(), "cname2.netty.io")));
records.add(new TestDnsServer.TestResourceRecord( records.add(new TestDnsServer.TestResourceRecord(
question.getDomainName(), RecordType.CNAME, question.getDomainName(), RecordType.CNAME,
Collections.<String, Object>singletonMap( Collections.singletonMap(
DnsAttribute.DOMAIN_NAME.toLowerCase(), "cname.netty.io"))); DnsAttribute.DOMAIN_NAME.toLowerCase(), "cname.netty.io")));
return records; return records;
} }
@ -2351,25 +2351,25 @@ public class DnsNameResolverTest {
if ("cname.netty.io".equals(question.getDomainName())) { if ("cname.netty.io".equals(question.getDomainName())) {
aQueries.incrementAndGet(); aQueries.incrementAndGet();
return Collections.<ResourceRecord>singleton(new TestDnsServer.TestResourceRecord( return Collections.singleton(new TestDnsServer.TestResourceRecord(
question.getDomainName(), RecordType.A, question.getDomainName(), RecordType.A,
Collections.<String, Object>singletonMap( Collections.singletonMap(
DnsAttribute.IP_ADDRESS.toLowerCase(), "10.0.0.99"))); DnsAttribute.IP_ADDRESS.toLowerCase(), "10.0.0.99")));
} }
if ("x.netty.io".equals(question.getDomainName())) { if ("x.netty.io".equals(question.getDomainName())) {
cnameQueries.incrementAndGet(); cnameQueries.incrementAndGet();
return Collections.<ResourceRecord>singleton(new TestDnsServer.TestResourceRecord( return Collections.singleton(new TestDnsServer.TestResourceRecord(
question.getDomainName(), RecordType.CNAME, question.getDomainName(), RecordType.CNAME,
Collections.<String, Object>singletonMap( Collections.singletonMap(
DnsAttribute.DOMAIN_NAME.toLowerCase(), "cname.netty.io"))); DnsAttribute.DOMAIN_NAME.toLowerCase(), "cname.netty.io")));
} }
if ("y.netty.io".equals(question.getDomainName())) { if ("y.netty.io".equals(question.getDomainName())) {
cnameQueries.incrementAndGet(); cnameQueries.incrementAndGet();
return Collections.<ResourceRecord>singleton(new TestDnsServer.TestResourceRecord( return Collections.singleton(new TestDnsServer.TestResourceRecord(
question.getDomainName(), RecordType.CNAME, question.getDomainName(), RecordType.CNAME,
Collections.<String, Object>singletonMap( Collections.singletonMap(
DnsAttribute.DOMAIN_NAME.toLowerCase(), "x.netty.io"))); DnsAttribute.DOMAIN_NAME.toLowerCase(), "x.netty.io")));
} }
return Collections.emptySet(); return Collections.emptySet();

View File

@ -282,7 +282,7 @@ public class SearchDomainTest {
@Test @Test
public void testExceptionMsgContainsSearchDomain() throws Exception { public void testExceptionMsgContainsSearchDomain() throws Exception {
TestDnsServer.MapRecordStoreA store = new TestDnsServer.MapRecordStoreA(Collections.<String>emptySet()); TestDnsServer.MapRecordStoreA store = new TestDnsServer.MapRecordStoreA(Collections.emptySet());
dnsServer = new TestDnsServer(store); dnsServer = new TestDnsServer(store);
dnsServer.start(); dnsServer.start();
@ -299,7 +299,7 @@ public class SearchDomainTest {
@Test @Test
public void testExceptionMsgDoesNotContainSearchDomainIfNdotsIsNotReached() throws Exception { public void testExceptionMsgDoesNotContainSearchDomainIfNdotsIsNotReached() throws Exception {
TestDnsServer.MapRecordStoreA store = new TestDnsServer.MapRecordStoreA(Collections.<String>emptySet()); TestDnsServer.MapRecordStoreA store = new TestDnsServer.MapRecordStoreA(Collections.emptySet());
dnsServer = new TestDnsServer(store); dnsServer = new TestDnsServer(store);
dnsServer.start(); dnsServer.start();

View File

@ -303,7 +303,7 @@ class TestDnsServer extends DnsServer {
default: default:
return null; return null;
} }
return Collections.<ResourceRecord>singleton( return Collections.singleton(
new TestResourceRecord(name, questionRecord.getRecordType(), attr)); new TestResourceRecord(name, questionRecord.getRecordType(), attr));
} }
return null; return null;

View File

@ -48,7 +48,7 @@ public final class SctpTestPermutation {
} }
// Make the list of ServerBootstrap factories. // Make the list of ServerBootstrap factories.
return Collections.<BootstrapFactory<ServerBootstrap>>singletonList(new BootstrapFactory<ServerBootstrap>() { return Collections.singletonList(new BootstrapFactory<ServerBootstrap>() {
@Override @Override
public ServerBootstrap newInstance() { public ServerBootstrap newInstance() {
return new ServerBootstrap(). return new ServerBootstrap().
@ -63,7 +63,7 @@ public final class SctpTestPermutation {
return Collections.emptyList(); return Collections.emptyList();
} }
return Collections.<BootstrapFactory<Bootstrap>>singletonList(new BootstrapFactory<Bootstrap>() { return Collections.singletonList(new BootstrapFactory<Bootstrap>() {
@Override @Override
public Bootstrap newInstance() { public Bootstrap newInstance() {
return new Bootstrap().group(nioWorkerGroup).channel(NioSctpChannel.class); return new Bootstrap().group(nioWorkerGroup).channel(NioSctpChannel.class);

View File

@ -102,7 +102,7 @@ public class SocketTestPermutation {
public List<BootstrapComboFactory<Bootstrap, Bootstrap>> datagram() { public List<BootstrapComboFactory<Bootstrap, Bootstrap>> datagram() {
// Make the list of Bootstrap factories. // Make the list of Bootstrap factories.
List<BootstrapFactory<Bootstrap>> bfs = Collections.<BootstrapFactory<Bootstrap>>singletonList( List<BootstrapFactory<Bootstrap>> bfs = Collections.singletonList(
new BootstrapFactory<Bootstrap>() { new BootstrapFactory<Bootstrap>() {
@Override @Override
public Bootstrap newInstance() { public Bootstrap newInstance() {
@ -126,7 +126,7 @@ public class SocketTestPermutation {
} }
public List<BootstrapFactory<ServerBootstrap>> serverSocket() { public List<BootstrapFactory<ServerBootstrap>> serverSocket() {
return Collections.<BootstrapFactory<ServerBootstrap>>singletonList( return Collections.singletonList(
new BootstrapFactory<ServerBootstrap>() { new BootstrapFactory<ServerBootstrap>() {
@Override @Override
public ServerBootstrap newInstance() { public ServerBootstrap newInstance() {
@ -138,7 +138,7 @@ public class SocketTestPermutation {
} }
public List<BootstrapFactory<Bootstrap>> clientSocket() { public List<BootstrapFactory<Bootstrap>> clientSocket() {
return Collections.<BootstrapFactory<Bootstrap>>singletonList( return Collections.singletonList(
new BootstrapFactory<Bootstrap>() { new BootstrapFactory<Bootstrap>() {
@Override @Override
public Bootstrap newInstance() { public Bootstrap newInstance() {
@ -149,7 +149,7 @@ public class SocketTestPermutation {
} }
public List<BootstrapFactory<Bootstrap>> datagramSocket() { public List<BootstrapFactory<Bootstrap>> datagramSocket() {
return Collections.<BootstrapFactory<Bootstrap>>singletonList( return Collections.singletonList(
new BootstrapFactory<Bootstrap>() { new BootstrapFactory<Bootstrap>() {
@Override @Override
public Bootstrap newInstance() { public Bootstrap newInstance() {

View File

@ -68,8 +68,8 @@ public class EpollSocketTcpMd5Test {
@Test @Test
public void testServerSocketChannelOption() throws Exception { public void testServerSocketChannelOption() throws Exception {
server.config().setOption(EpollChannelOption.TCP_MD5SIG, server.config().setOption(EpollChannelOption.TCP_MD5SIG,
Collections.<InetAddress, byte[]>singletonMap(NetUtil.LOCALHOST4, SERVER_KEY)); Collections.singletonMap(NetUtil.LOCALHOST4, SERVER_KEY));
server.config().setOption(EpollChannelOption.TCP_MD5SIG, Collections.<InetAddress, byte[]>emptyMap()); server.config().setOption(EpollChannelOption.TCP_MD5SIG, Collections.emptyMap());
} }
@Test @Test
@ -81,8 +81,8 @@ public class EpollSocketTcpMd5Test {
.bind(new InetSocketAddress(0)).syncUninterruptibly().channel(); .bind(new InetSocketAddress(0)).syncUninterruptibly().channel();
ch.config().setOption(EpollChannelOption.TCP_MD5SIG, ch.config().setOption(EpollChannelOption.TCP_MD5SIG,
Collections.<InetAddress, byte[]>singletonMap(NetUtil.LOCALHOST4, SERVER_KEY)); Collections.singletonMap(NetUtil.LOCALHOST4, SERVER_KEY));
ch.config().setOption(EpollChannelOption.TCP_MD5SIG, Collections.<InetAddress, byte[]>emptyMap()); ch.config().setOption(EpollChannelOption.TCP_MD5SIG, Collections.emptyMap());
ch.close().syncUninterruptibly(); ch.close().syncUninterruptibly();
} }
@ -90,13 +90,13 @@ public class EpollSocketTcpMd5Test {
@Test(expected = ConnectTimeoutException.class) @Test(expected = ConnectTimeoutException.class)
public void testKeyMismatch() throws Exception { public void testKeyMismatch() throws Exception {
server.config().setOption(EpollChannelOption.TCP_MD5SIG, server.config().setOption(EpollChannelOption.TCP_MD5SIG,
Collections.<InetAddress, byte[]>singletonMap(NetUtil.LOCALHOST4, SERVER_KEY)); Collections.singletonMap(NetUtil.LOCALHOST4, SERVER_KEY));
EpollSocketChannel client = (EpollSocketChannel) new Bootstrap().group(GROUP) EpollSocketChannel client = (EpollSocketChannel) new Bootstrap().group(GROUP)
.channel(EpollSocketChannel.class) .channel(EpollSocketChannel.class)
.handler(new ChannelInboundHandlerAdapter()) .handler(new ChannelInboundHandlerAdapter())
.option(EpollChannelOption.TCP_MD5SIG, .option(EpollChannelOption.TCP_MD5SIG,
Collections.<InetAddress, byte[]>singletonMap(NetUtil.LOCALHOST4, BAD_KEY)) Collections.singletonMap(NetUtil.LOCALHOST4, BAD_KEY))
.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 1000) .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 1000)
.connect(server.localAddress()).syncUninterruptibly().channel(); .connect(server.localAddress()).syncUninterruptibly().channel();
client.close().syncUninterruptibly(); client.close().syncUninterruptibly();
@ -105,13 +105,13 @@ public class EpollSocketTcpMd5Test {
@Test @Test
public void testKeyMatch() throws Exception { public void testKeyMatch() throws Exception {
server.config().setOption(EpollChannelOption.TCP_MD5SIG, server.config().setOption(EpollChannelOption.TCP_MD5SIG,
Collections.<InetAddress, byte[]>singletonMap(NetUtil.LOCALHOST4, SERVER_KEY)); Collections.singletonMap(NetUtil.LOCALHOST4, SERVER_KEY));
EpollSocketChannel client = (EpollSocketChannel) new Bootstrap().group(GROUP) EpollSocketChannel client = (EpollSocketChannel) new Bootstrap().group(GROUP)
.channel(EpollSocketChannel.class) .channel(EpollSocketChannel.class)
.handler(new ChannelInboundHandlerAdapter()) .handler(new ChannelInboundHandlerAdapter())
.option(EpollChannelOption.TCP_MD5SIG, .option(EpollChannelOption.TCP_MD5SIG,
Collections.<InetAddress, byte[]>singletonMap(NetUtil.LOCALHOST4, SERVER_KEY)) Collections.singletonMap(NetUtil.LOCALHOST4, SERVER_KEY))
.connect(server.localAddress()).syncUninterruptibly().channel(); .connect(server.localAddress()).syncUninterruptibly().channel();
client.close().syncUninterruptibly(); client.close().syncUninterruptibly();
} }

View File

@ -160,7 +160,7 @@ class EpollSocketTestPermutation extends SocketTestPermutation {
} }
public List<BootstrapFactory<ServerBootstrap>> serverDomainSocket() { public List<BootstrapFactory<ServerBootstrap>> serverDomainSocket() {
return Collections.<BootstrapFactory<ServerBootstrap>>singletonList( return Collections.singletonList(
new BootstrapFactory<ServerBootstrap>() { new BootstrapFactory<ServerBootstrap>() {
@Override @Override
public ServerBootstrap newInstance() { public ServerBootstrap newInstance() {
@ -172,7 +172,7 @@ class EpollSocketTestPermutation extends SocketTestPermutation {
} }
public List<BootstrapFactory<Bootstrap>> clientDomainSocket() { public List<BootstrapFactory<Bootstrap>> clientDomainSocket() {
return Collections.<BootstrapFactory<Bootstrap>>singletonList( return Collections.singletonList(
new BootstrapFactory<Bootstrap>() { new BootstrapFactory<Bootstrap>() {
@Override @Override
public Bootstrap newInstance() { public Bootstrap newInstance() {
@ -184,7 +184,7 @@ class EpollSocketTestPermutation extends SocketTestPermutation {
@Override @Override
public List<BootstrapFactory<Bootstrap>> datagramSocket() { public List<BootstrapFactory<Bootstrap>> datagramSocket() {
return Collections.<BootstrapFactory<Bootstrap>>singletonList( return Collections.singletonList(
new BootstrapFactory<Bootstrap>() { new BootstrapFactory<Bootstrap>() {
@Override @Override
public Bootstrap newInstance() { public Bootstrap newInstance() {

View File

@ -145,7 +145,7 @@ class KQueueSocketTestPermutation extends SocketTestPermutation {
} }
public List<BootstrapFactory<ServerBootstrap>> serverDomainSocket() { public List<BootstrapFactory<ServerBootstrap>> serverDomainSocket() {
return Collections.<BootstrapFactory<ServerBootstrap>>singletonList( return Collections.singletonList(
new BootstrapFactory<ServerBootstrap>() { new BootstrapFactory<ServerBootstrap>() {
@Override @Override
public ServerBootstrap newInstance() { public ServerBootstrap newInstance() {
@ -157,7 +157,7 @@ class KQueueSocketTestPermutation extends SocketTestPermutation {
} }
public List<BootstrapFactory<Bootstrap>> clientDomainSocket() { public List<BootstrapFactory<Bootstrap>> clientDomainSocket() {
return Collections.<BootstrapFactory<Bootstrap>>singletonList( return Collections.singletonList(
new BootstrapFactory<Bootstrap>() { new BootstrapFactory<Bootstrap>() {
@Override @Override
public Bootstrap newInstance() { public Bootstrap newInstance() {
@ -169,7 +169,7 @@ class KQueueSocketTestPermutation extends SocketTestPermutation {
@Override @Override
public List<BootstrapFactory<Bootstrap>> datagramSocket() { public List<BootstrapFactory<Bootstrap>> datagramSocket() {
return Collections.<BootstrapFactory<Bootstrap>>singletonList( return Collections.singletonList(
new BootstrapFactory<Bootstrap>() { new BootstrapFactory<Bootstrap>() {
@Override @Override
public Bootstrap newInstance() { public Bootstrap newInstance() {

View File

@ -161,8 +161,8 @@ public class SingleThreadEventLoop extends SingleThreadEventExecutor implements
@Override @Override
protected Queue<Runnable> newTaskQueue(int maxPendingTasks) { protected Queue<Runnable> newTaskQueue(int maxPendingTasks) {
// This event loop never calls takeTask() // This event loop never calls takeTask()
return maxPendingTasks == Integer.MAX_VALUE ? PlatformDependent.<Runnable>newMpscQueue() return maxPendingTasks == Integer.MAX_VALUE ? PlatformDependent.newMpscQueue()
: PlatformDependent.<Runnable>newMpscQueue(maxPendingTasks); : PlatformDependent.newMpscQueue(maxPendingTasks);
} }
@Override @Override