I have an enumeration that is serialized/deserialized by Gson:
enum class PacketType {
NONE;
[SerializedName("request")]
REQUEST;
[SerializedName("response")]
RESPONSE;
[SerializedName("event")]
EVENT;
}
Unfortunately, I noticed that Gson ignores SerializedName
annotations and uses upper case names for enum values. I decided to find out why serialization doesn't work as intended and found out that Kotlin drops all annotations for enum values. How can I make these annotations appear in generated bytecode?
Looks like a bug to me. Please report to the issue tracker.
As a temporary workaround, you can write this class in Java