那么覆盖的问题是什么呢?我不明白:
@Override
public ProtocolEncoder getEncoder(IoSession session) throws Exception {
return encoder;
}
@Override
public ProtocolDecoder getDecoder(IoSession session) throws Exception {
return decoder;
}错误:
error: method does not override or implement a method from a supertype
@Override
error: MaplePacketDecoder is not abstract and does not override abstract method doDecode(IoSession,ByteBuffer,ProtocolDecoderOutput) in CumulativeProtocolDecoder
public class MaplePacketDecoder extends CumulativeProtocolDecoder {
error: method write in interface ProtocolEncoderOutput cannot be applied to given types;
out.write(IoBuffer.wrap(ret));
required: ByteBuffer
found: IoBuffer
reason: actual argument IoBuffer cannot be converted to ByteBuffer by method invocation conversion发布于 2014-07-11 04:56:16
您忘记了实现doDecode(IoSession,ByteBuffer,ProtocolDecoderOutput)。
发布于 2014-07-11 05:08:42
您正试图用不同的参数(不同的签名)覆盖超类中的方法。重写方法必须匹配被重写的方法的签名(在父类中)。
http://docs.oracle.com/javase/tutorial/java/IandI/override.html
发布于 2014-07-11 05:04:55
您尝试重写的方法名称或您提供的参数似乎不正确。此外,您也不能从CumulativeProtocolDecoder实现doDecode方法。如果CumulativeProtocolDecoder是一个抽象类,那么你应该实现它。
https://stackoverflow.com/questions/24686091
复制相似问题