Fix all Xlint:unchecked warnings
This commit is contained in:
parent
b33df8399e
commit
818a7b42a3
@ -32,6 +32,7 @@ public class DefaultAttributeMap implements AttributeMap {
|
||||
map = this.map = new IdentityHashMap<AttributeKey<?>, Attribute<?>>(2);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
Attribute<T> attr = (Attribute<T>) map.get(key);
|
||||
if (attr == null) {
|
||||
attr = new DefaultAttribute<T>();
|
||||
|
@ -153,7 +153,9 @@ public abstract class AbstractBootstrap<B extends AbstractBootstrap<?>> {
|
||||
attrs.put(key, value);
|
||||
}
|
||||
|
||||
return (B) this;
|
||||
@SuppressWarnings("unchecked")
|
||||
B b = (B) this;
|
||||
return b;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -173,7 +173,9 @@ public class ServerBootstrap extends AbstractBootstrap<ServerBootstrap> {
|
||||
}
|
||||
|
||||
for (Entry<AttributeKey<?>, Object> e: attrs().entrySet()) {
|
||||
channel.attr((AttributeKey<Object>) e.getKey()).set(e.getValue());
|
||||
@SuppressWarnings("unchecked")
|
||||
AttributeKey<Object> key = (AttributeKey<Object>) e.getKey();
|
||||
channel.attr(key).set(e.getValue());
|
||||
}
|
||||
|
||||
ChannelPipeline p = future.channel().pipeline();
|
||||
|
@ -278,8 +278,9 @@ public abstract class AbstractChannel extends DefaultAttributeMap implements Cha
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageBuf<Object> outboundMessageBuffer() {
|
||||
return pipeline.outboundMessageBuffer();
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> MessageBuf<T> outboundMessageBuffer() {
|
||||
return (MessageBuf<T>) pipeline.outboundMessageBuffer();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -49,7 +49,7 @@ public abstract class AbstractServerChannel extends AbstractChannel implements S
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageBuf<Object> outboundMessageBuffer() {
|
||||
public <T> MessageBuf<T> outboundMessageBuffer() {
|
||||
throw new NoSuchBufferException(String.format(
|
||||
"%s does not have an outbound buffer.", ServerChannel.class.getSimpleName()));
|
||||
}
|
||||
|
@ -205,9 +205,9 @@ import java.util.NoSuchElementException;
|
||||
*/
|
||||
public interface ChannelPipeline extends ChannelInboundInvoker, ChannelOutboundInvoker {
|
||||
|
||||
MessageBuf<Object> inboundMessageBuffer();
|
||||
<T> MessageBuf<T> inboundMessageBuffer();
|
||||
ByteBuf inboundByteBuffer();
|
||||
MessageBuf<Object> outboundMessageBuffer();
|
||||
<T> MessageBuf<T> outboundMessageBuffer();
|
||||
ByteBuf outboundByteBuffer();
|
||||
|
||||
/**
|
||||
|
@ -355,7 +355,9 @@ final class DefaultChannelHandlerContext extends DefaultAttributeMap implements
|
||||
} else if (buf instanceof MessageBuf) {
|
||||
outByteBuf = null;
|
||||
outByteBridge = null;
|
||||
outMsgBuf = (MessageBuf<Object>) buf;
|
||||
@SuppressWarnings("unchecked")
|
||||
MessageBuf<Object> msgBuf = (MessageBuf<Object>) buf;
|
||||
outMsgBuf = msgBuf;
|
||||
outMsgBridge = new AtomicReference<MessageBridge>();
|
||||
} else {
|
||||
throw new Error();
|
||||
|
@ -844,8 +844,9 @@ public class DefaultChannelPipeline implements ChannelPipeline {
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageBuf<Object> inboundMessageBuffer() {
|
||||
return head.nextInboundMessageBuffer();
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> MessageBuf<T> inboundMessageBuffer() {
|
||||
return (MessageBuf<T>) head.nextInboundMessageBuffer();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -854,8 +855,9 @@ public class DefaultChannelPipeline implements ChannelPipeline {
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageBuf<Object> outboundMessageBuffer() {
|
||||
return nextOutboundMessageBuffer(tail);
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> MessageBuf<T> outboundMessageBuffer() {
|
||||
return (MessageBuf<T>) nextOutboundMessageBuffer(tail);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -306,7 +306,9 @@ public final class NioEventLoop extends SingleThreadEventLoop {
|
||||
if (a instanceof AbstractNioChannel) {
|
||||
processSelectedKey(k, (AbstractNioChannel) a);
|
||||
} else {
|
||||
processSelectedKey(k, (NioTask<SelectableChannel>) a);
|
||||
@SuppressWarnings("unchecked")
|
||||
NioTask<SelectableChannel> task = (NioTask<SelectableChannel>) a;
|
||||
processSelectedKey(k, task);
|
||||
}
|
||||
|
||||
if (cleanedCancelledKeys) {
|
||||
@ -376,7 +378,9 @@ public final class NioEventLoop extends SingleThreadEventLoop {
|
||||
channels.add((Channel) a);
|
||||
} else {
|
||||
k.cancel();
|
||||
invokeChannelUnregistered((NioTask<SelectableChannel>) a, k);
|
||||
@SuppressWarnings("unchecked")
|
||||
NioTask<SelectableChannel> task = (NioTask<SelectableChannel>) a;
|
||||
invokeChannelUnregistered(task, k);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user