various errorprone fixes.
Motivation: Continuing to make netty happy when compiling through errorprone. Modification: Mostly comments, some minor switch statement changes. Result: No more compiler errors!
This commit is contained in:
parent
cbce95eae1
commit
b18a201d02
|
@ -104,6 +104,7 @@ public class Bzip2Decoder extends ByteToMessageDecoder {
|
|||
|
||||
streamCRC = 0;
|
||||
currentState = State.INIT_BLOCK;
|
||||
// fall through
|
||||
case INIT_BLOCK:
|
||||
if (!reader.hasReadableBytes(10)) {
|
||||
return;
|
||||
|
@ -125,6 +126,7 @@ public class Bzip2Decoder extends ByteToMessageDecoder {
|
|||
}
|
||||
blockCRC = reader.readInt();
|
||||
currentState = State.INIT_BLOCK_PARAMS;
|
||||
// fall through
|
||||
case INIT_BLOCK_PARAMS:
|
||||
if (!reader.hasReadableBits(25)) {
|
||||
return;
|
||||
|
@ -135,12 +137,14 @@ public class Bzip2Decoder extends ByteToMessageDecoder {
|
|||
blockDecompressor = new Bzip2BlockDecompressor(this.blockSize, blockCRC,
|
||||
blockRandomised, bwtStartPointer, reader);
|
||||
currentState = State.RECEIVE_HUFFMAN_USED_MAP;
|
||||
// fall through
|
||||
case RECEIVE_HUFFMAN_USED_MAP:
|
||||
if (!reader.hasReadableBits(16)) {
|
||||
return;
|
||||
}
|
||||
blockDecompressor.huffmanInUse16 = reader.readBits(16);
|
||||
currentState = State.RECEIVE_HUFFMAN_USED_BITMAPS;
|
||||
// fall through
|
||||
case RECEIVE_HUFFMAN_USED_BITMAPS:
|
||||
Bzip2BlockDecompressor blockDecompressor = this.blockDecompressor;
|
||||
final int inUse16 = blockDecompressor.huffmanInUse16;
|
||||
|
@ -175,6 +179,7 @@ public class Bzip2Decoder extends ByteToMessageDecoder {
|
|||
}
|
||||
huffmanStageDecoder = new Bzip2HuffmanStageDecoder(reader, totalTables, alphaSize);
|
||||
currentState = State.RECEIVE_SELECTORS_NUMBER;
|
||||
// fall through
|
||||
case RECEIVE_SELECTORS_NUMBER:
|
||||
if (!reader.hasReadableBits(15)) {
|
||||
return;
|
||||
|
@ -186,6 +191,7 @@ public class Bzip2Decoder extends ByteToMessageDecoder {
|
|||
huffmanStageDecoder.selectors = new byte[totalSelectors];
|
||||
|
||||
currentState = State.RECEIVE_SELECTORS;
|
||||
// fall through
|
||||
case RECEIVE_SELECTORS:
|
||||
Bzip2HuffmanStageDecoder huffmanStageDecoder = this.huffmanStageDecoder;
|
||||
byte[] selectors = huffmanStageDecoder.selectors;
|
||||
|
@ -209,6 +215,7 @@ public class Bzip2Decoder extends ByteToMessageDecoder {
|
|||
}
|
||||
|
||||
currentState = State.RECEIVE_HUFFMAN_LENGTH;
|
||||
// fall through
|
||||
case RECEIVE_HUFFMAN_LENGTH:
|
||||
huffmanStageDecoder = this.huffmanStageDecoder;
|
||||
totalTables = huffmanStageDecoder.totalTables;
|
||||
|
@ -268,6 +275,7 @@ public class Bzip2Decoder extends ByteToMessageDecoder {
|
|||
// Finally create the Huffman tables
|
||||
huffmanStageDecoder.createHuffmanDecodingTables();
|
||||
currentState = State.DECODE_HUFFMAN_DATA;
|
||||
// fall through
|
||||
case DECODE_HUFFMAN_DATA:
|
||||
blockDecompressor = this.blockDecompressor;
|
||||
final int oldReaderIndex = in.readerIndex();
|
||||
|
|
|
@ -113,9 +113,11 @@ public class Bzip2Encoder extends MessageToByteEncoder<ByteBuf> {
|
|||
out.writeMedium(MAGIC_NUMBER);
|
||||
out.writeByte('0' + streamBlockSize / BASE_BLOCK_SIZE);
|
||||
currentState = State.INIT_BLOCK;
|
||||
// fall through
|
||||
case INIT_BLOCK:
|
||||
blockCompressor = new Bzip2BlockCompressor(writer, streamBlockSize);
|
||||
currentState = State.WRITE_DATA;
|
||||
// fall through
|
||||
case WRITE_DATA:
|
||||
if (!in.isReadable()) {
|
||||
return;
|
||||
|
@ -132,6 +134,7 @@ public class Bzip2Encoder extends MessageToByteEncoder<ByteBuf> {
|
|||
}
|
||||
}
|
||||
currentState = State.CLOSE_BLOCK;
|
||||
// fall through
|
||||
case CLOSE_BLOCK:
|
||||
closeBlock(out);
|
||||
currentState = State.INIT_BLOCK;
|
||||
|
|
|
@ -159,6 +159,7 @@ final class Bzip2HuffmanAllocator {
|
|||
switch (array.length) {
|
||||
case 2:
|
||||
array[1] = 1;
|
||||
// fall through
|
||||
case 1:
|
||||
array[0] = 1;
|
||||
return;
|
||||
|
|
|
@ -90,6 +90,7 @@ final class FastLz {
|
|||
*
|
||||
* If the input is not compressible, the return value might be larger than length (input buffer size).
|
||||
*/
|
||||
@SuppressWarnings("IdentityBinaryExpression")
|
||||
static int compress(final byte[] input, final int inOffset, final int inLength,
|
||||
final byte[] output, final int outOffset, final int proposedLevel) {
|
||||
final int level;
|
||||
|
|
|
@ -126,6 +126,7 @@ public class FastLzFrameDecoder extends ByteToMessageDecoder {
|
|||
hasChecksum = (options & 0x10) == BLOCK_WITH_CHECKSUM;
|
||||
|
||||
currentState = State.INIT_BLOCK_PARAMS;
|
||||
// fall through
|
||||
case INIT_BLOCK_PARAMS:
|
||||
if (in.readableBytes() < 2 + (isCompressed ? 2 : 0) + (hasChecksum ? 4 : 0)) {
|
||||
break;
|
||||
|
@ -135,6 +136,7 @@ public class FastLzFrameDecoder extends ByteToMessageDecoder {
|
|||
originalLength = isCompressed ? in.readUnsignedShort() : chunkLength;
|
||||
|
||||
currentState = State.DECOMPRESS_DATA;
|
||||
// fall through
|
||||
case DECOMPRESS_DATA:
|
||||
final int chunkLength = this.chunkLength;
|
||||
if (in.readableBytes() < chunkLength) {
|
||||
|
|
|
@ -269,6 +269,7 @@ public class JdkZlibDecoder extends ZlibDecoder {
|
|||
crc.update(in.readUnsignedByte()); // operating system
|
||||
|
||||
gzipState = GzipState.FLG_READ;
|
||||
// fall through
|
||||
case FLG_READ:
|
||||
if ((flags & FEXTRA) != 0) {
|
||||
if (in.readableBytes() < 2) {
|
||||
|
@ -282,6 +283,7 @@ public class JdkZlibDecoder extends ZlibDecoder {
|
|||
xlen |= xlen1 << 8 | xlen2;
|
||||
}
|
||||
gzipState = GzipState.XLEN_READ;
|
||||
// fall through
|
||||
case XLEN_READ:
|
||||
if (xlen != -1) {
|
||||
if (in.readableBytes() < xlen) {
|
||||
|
@ -291,6 +293,7 @@ public class JdkZlibDecoder extends ZlibDecoder {
|
|||
in.skipBytes(xlen);
|
||||
}
|
||||
gzipState = GzipState.SKIP_FNAME;
|
||||
// fall through
|
||||
case SKIP_FNAME:
|
||||
if ((flags & FNAME) != 0) {
|
||||
if (!in.isReadable()) {
|
||||
|
@ -305,6 +308,7 @@ public class JdkZlibDecoder extends ZlibDecoder {
|
|||
} while (in.isReadable());
|
||||
}
|
||||
gzipState = GzipState.SKIP_COMMENT;
|
||||
// fall through
|
||||
case SKIP_COMMENT:
|
||||
if ((flags & FCOMMENT) != 0) {
|
||||
if (!in.isReadable()) {
|
||||
|
@ -319,6 +323,7 @@ public class JdkZlibDecoder extends ZlibDecoder {
|
|||
} while (in.isReadable());
|
||||
}
|
||||
gzipState = GzipState.PROCESS_FHCRC;
|
||||
// fall through
|
||||
case PROCESS_FHCRC:
|
||||
if ((flags & FHCRC) != 0) {
|
||||
if (in.readableBytes() < 4) {
|
||||
|
@ -328,6 +333,7 @@ public class JdkZlibDecoder extends ZlibDecoder {
|
|||
}
|
||||
crc.reset();
|
||||
gzipState = GzipState.HEADER_END;
|
||||
// fall through
|
||||
case HEADER_END:
|
||||
return true;
|
||||
default:
|
||||
|
|
|
@ -242,6 +242,8 @@ public class JdkZlibEncoder extends ZlibEncoder {
|
|||
case ZLIB:
|
||||
sizeEstimate += 2; // first two magic bytes
|
||||
break;
|
||||
default:
|
||||
// no op
|
||||
}
|
||||
}
|
||||
return ctx.alloc().heapBuffer(sizeEstimate);
|
||||
|
|
|
@ -202,6 +202,7 @@ public class Lz4FrameDecoder extends ByteToMessageDecoder {
|
|||
this.currentChecksum = currentChecksum;
|
||||
|
||||
currentState = State.DECOMPRESS_DATA;
|
||||
// fall through
|
||||
case DECOMPRESS_DATA:
|
||||
blockType = this.blockType;
|
||||
compressedLength = this.compressedLength;
|
||||
|
|
|
@ -140,6 +140,7 @@ public class LzfDecoder extends ByteToMessageDecoder {
|
|||
if (type != BLOCK_TYPE_COMPRESSED) {
|
||||
break;
|
||||
}
|
||||
// fall through
|
||||
case INIT_ORIGINAL_LENGTH:
|
||||
if (in.readableBytes() < 2) {
|
||||
break;
|
||||
|
@ -147,6 +148,7 @@ public class LzfDecoder extends ByteToMessageDecoder {
|
|||
originalLength = in.readUnsignedShort();
|
||||
|
||||
currentState = State.DECOMPRESS_DATA;
|
||||
// fall through
|
||||
case DECOMPRESS_DATA:
|
||||
final int chunkLength = this.chunkLength;
|
||||
if (in.readableBytes() < chunkLength) {
|
||||
|
|
|
@ -272,6 +272,7 @@ public final class Snappy {
|
|||
switch (state) {
|
||||
case READY:
|
||||
state = State.READING_PREAMBLE;
|
||||
// fall through
|
||||
case READING_PREAMBLE:
|
||||
int uncompressedLength = readPreamble(in);
|
||||
if (uncompressedLength == PREAMBLE_NOT_FULL) {
|
||||
|
@ -285,6 +286,7 @@ public final class Snappy {
|
|||
}
|
||||
out.ensureWritable(uncompressedLength);
|
||||
state = State.READING_TAG;
|
||||
// fall through
|
||||
case READING_TAG:
|
||||
if (!in.isReadable()) {
|
||||
return;
|
||||
|
|
|
@ -490,6 +490,7 @@ public final class StringUtil {
|
|||
break;
|
||||
}
|
||||
// double-quote appears without being enclosed with double-quotes
|
||||
// fall through
|
||||
case LINE_FEED:
|
||||
// fall through
|
||||
case CARRIAGE_RETURN:
|
||||
|
|
|
@ -439,8 +439,8 @@ public final class NioEventLoop extends SingleThreadEventLoop {
|
|||
if (wakenUp.get()) {
|
||||
selector.wakeup();
|
||||
}
|
||||
// fall through
|
||||
default:
|
||||
// fallthrough
|
||||
}
|
||||
|
||||
cancelledKeys = 0;
|
||||
|
|
Loading…
Reference in New Issue