IntelliJ IDEA generating serialVersionUID

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

    In addition you can add live template that will do the work.

    To do it press Ctrl+Alt+S -> "Live Templates" section -> other (or w/e you wish)

    And then create a new one with a definition like this:

    private static final long serialVersionUID = 1L;
    $END$
    

    Then select definition scope and save it as 'serial'

    Now you can type serialTAB in class body.

提交回复
热议问题