Skip to content

Commit

Permalink
Modernize switch statements in FST (apache#13756)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrhbj authored Sep 11, 2024
1 parent ccccf92 commit 029c3b5
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions lucene/core/src/java/org/apache/lucene/util/fst/FST.java
Original file line number Diff line number Diff line change
Expand Up @@ -481,19 +481,13 @@ public static <T> FSTMetadata<T> readMetadata(DataInput metaIn, Outputs<T> outpu
}
INPUT_TYPE inputType;
final byte t = metaIn.readByte();
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);
}
inputType =
switch (t) {
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);
Expand Down

0 comments on commit 029c3b5

Please sign in to comment.