Modernize switch statements in FST (#13756)

This commit is contained in:
mrhbj 2024-09-11 15:46:48 +08:00 committed by GitHub
parent ccccf92abd
commit 029c3b5e13
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 13 deletions

View File

@ -481,19 +481,13 @@ public final class FST<T> implements Accountable {
}
INPUT_TYPE inputType;
final byte t = metaIn.readByte();
inputType =
switch (t) {
case 0:
inputType = INPUT_TYPE.BYTE1;
break;
case 1:
inputType = INPUT_TYPE.BYTE2;
break;
case 2:
inputType = INPUT_TYPE.BYTE4;
break;
default:
throw new CorruptIndexException("invalid input type " + t, metaIn);
}
case 0 -> INPUT_TYPE.BYTE1;
case 1 -> INPUT_TYPE.BYTE2;
case 2 -> INPUT_TYPE.BYTE4;
default -> throw new CorruptIndexException("invalid input type " + t, metaIn);
};
long startNode = metaIn.readVLong();
long numBytes = metaIn.readVLong();
return new FSTMetadata<>(inputType, outputs, emptyOutput, startNode, version, numBytes);