IntelliJ IDEA generating serialVersionUID

前端 未结 12 2110
生来不讨喜
生来不讨喜 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:48

    Easiest modern method: Alt+Enter on

    private static final long serialVersionUID = ;
    

    IntelliJ will underline the space after the =. put your cursor on it and hit alt+Enter (Option+Enter on Mac). You'll get a popover that says "Randomly Change serialVersionUID Initializer". Just hit enter, and it'll populate that space with a random long.

提交回复
热议问题