kotlin-ipv8
kotlin-ipv8 copied to clipboard
Serialization of UShort uses Int as a parameter instead of explicit Kotlin type
trafficstars
When working on serialization of some packets I tried to improve the interface to use some more generic methods (will post another pull request) I have stumbled upon the code for UShort (de)serialization. https://github.com/Tribler/kotlin-ipv8/blob/476dc36d0a5208d4a6ef21d953e00e4a440046a4/ipv8/src/main/java/nl/tudelft/ipv8/messaging/Serialization.kt#L36-L45
For some reason these use usual Int as the input for the method instead of UShort which exists in the Kotlin stdlib. Is there any reasoning why the code does not follow the other examples? Types like UInt, ULong and UChar all use already existing types and that seems to be a weird exception.