IntelliJ IDEA generating serialVersionUID

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

    In order to generate the value use

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

    and provide the randomLong template variable with the following value: groovyScript("new Random().nextLong().abs()")

    https://pharsfalvi.wordpress.com/2015/03/18/adding-serialversionuid-in-idea/

提交回复
热议问题