How to generate serialVersionUID for kotlin exceptions?

后端 未结 3 1108
一个人的身影
一个人的身影 2021-02-06 04:28

As kotlin doesn\'t have static fields, should I define serialVersionUID in companion object?

3条回答
  •  离开以前
    2021-02-06 04:46

    You can use this plugin GenerateSerialVersionUID to automatically generate the serialVersionUID field.

    Since Kotlin language does not support static, you need to use the const decoration in the generated companion object (of course, it is also possible to use the @JvmField annotation).

提交回复
热议问题