如何在Intellij中生成串行版UID [英] How to generate serial version UID in Intellij

查看:204
本文介绍了如何在Intellij中生成串行版UID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用 Eclipse 时,它有一个很好的功能来生成串行版本UID。

When I used Eclipse it had a nice feature to generate serial version UID.

但是在IntelliJ中做什么?

But what to do in IntelliJ?

如何在IntelliJ中选择或生成相同的串行版本UID?

How to choose or generate identical serial version UID in IntelliJ?

修改旧课时该怎么办?

如果你没有指定 id ,它是在运行时生成的......

If you haven't specify the id, it is generated at runtime...

推荐答案

没有任何插件:

您只需要启用突出显示:(创意v.2016,2017和2018,以前的版本可能有相同或类似的设置)

You just need to enable highlight: (Idea v.2016, 2017 and 2018, previous versions may have same or similar settings)


文件 - >设置 - >编辑器 - >检查 - > Java - >序列化问题 - >不带'serialVersionUID'的Serializable类 - 设置标志并单击'确定'。

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

现在,如果您的类实现了 Serializable ,您将看到突出显示并且类名上的alt + Enter将建议生成 private static final long serialVersionUID

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.

这篇关于如何在Intellij中生成串行版UID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆