Skip to content

Commit

Permalink
Fix code style inconsistencies
Browse files Browse the repository at this point in the history
  • Loading branch information
rchomczyk committed Feb 28, 2024
1 parent efeda10 commit 1895b5c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,16 +152,12 @@ public PacketPacker packEnum(Enum<?> value) throws IOException {
@Override
public @SuppressWarnings("unchecked") <T> PacketPacker packAuto(final T value) throws IOException {
return packOrNil(value, (packer, val) -> {
final Class<?> rawType = val.getClass();
final Class<?> type = getBoxedType(val.getClass());
if (!rawType.isEnum()) {
this.packString(type.getName());
}

final ThrowingBiConsumer<PacketPacker, T, IOException> packerFunction =
(ThrowingBiConsumer<PacketPacker, T, IOException>) PACKET_PACKER_BY_BOXED_TYPE.get(
type
);
this.packString(type.getName());
packerFunction.accept(this, val);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public Duration unpackDuration() throws IOException {
final Class<?> type = getClassByNameOrThrow(className);
final ThrowingFunction<PacketUnpacker, T, IOException> unpackerFunction =
(ThrowingFunction<PacketUnpacker, T, IOException>) PACKET_UNPACKER_BY_BOXED_TYPE.get(
type
type.isEnum() ? Enum.class : type
);
return unpackerFunction.apply(this);
}
Expand Down

0 comments on commit 1895b5c

Please sign in to comment.