IntelliJ IDEA generating serialVersionUID

前端 未结 12 2113
生来不讨喜
生来不讨喜 2020-12-04 05:04

How do generate this value in IntelliJ IDEA?

I go to Settings -> Errors -> Serialization issues -> Serializable class without ‘serialVersi

12条回答
  •  遥遥无期
    2020-12-04 05:38

    Without any plugins: You just need to enable highlight in IntelliJ:

    IntelliJ Preferences -> Editor -> Inspections -> Java -> Serialization issues -> Serializable class without 'serialVersionUID' - set flag and click 'OK'.

    Now, if your class implements Serializable, you will see highlight, and alt+Enter on class name will propose to generate private static final long serialVersionUID.

    PS: Taken from here

提交回复
热议问题