From 1895b5c6d70eeffa8663297cdf7f2505798f90f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Chomczyk?= Date: Wed, 28 Feb 2024 15:32:42 +0100 Subject: [PATCH] Fix code style inconsistencies --- .../java/moe/rafal/cory/serdes/MessagePackPacketPacker.java | 6 +----- .../moe/rafal/cory/serdes/MessagePackPacketUnpacker.java | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/cory-serdes-msgpack/src/main/java/moe/rafal/cory/serdes/MessagePackPacketPacker.java b/cory-serdes-msgpack/src/main/java/moe/rafal/cory/serdes/MessagePackPacketPacker.java index a0ea16e..b6d5f18 100644 --- a/cory-serdes-msgpack/src/main/java/moe/rafal/cory/serdes/MessagePackPacketPacker.java +++ b/cory-serdes-msgpack/src/main/java/moe/rafal/cory/serdes/MessagePackPacketPacker.java @@ -152,16 +152,12 @@ public PacketPacker packEnum(Enum value) throws IOException { @Override public @SuppressWarnings("unchecked") 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 packerFunction = (ThrowingBiConsumer) PACKET_PACKER_BY_BOXED_TYPE.get( type ); + this.packString(type.getName()); packerFunction.accept(this, val); }); } diff --git a/cory-serdes-msgpack/src/main/java/moe/rafal/cory/serdes/MessagePackPacketUnpacker.java b/cory-serdes-msgpack/src/main/java/moe/rafal/cory/serdes/MessagePackPacketUnpacker.java index 402e489..ca3b956 100644 --- a/cory-serdes-msgpack/src/main/java/moe/rafal/cory/serdes/MessagePackPacketUnpacker.java +++ b/cory-serdes-msgpack/src/main/java/moe/rafal/cory/serdes/MessagePackPacketUnpacker.java @@ -189,7 +189,7 @@ public Duration unpackDuration() throws IOException { final Class type = getClassByNameOrThrow(className); final ThrowingFunction unpackerFunction = (ThrowingFunction) PACKET_UNPACKER_BY_BOXED_TYPE.get( - type + type.isEnum() ? Enum.class : type ); return unpackerFunction.apply(this); }