IntelliJ IDEA 生成 serialVersionUID [英] IntelliJ IDEA generating serialVersionUID

查看:39
本文介绍了IntelliJ IDEA 生成 serialVersionUID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 IntelliJ IDEA 中生成这个值?

How do generate this value in IntelliJ IDEA?

我转到设置 -> 错误 -> 序列化问题 -> 没有serialVersionUID"的可序列化类,但它仍然没有给我看警告.我的 PKladrBuilding 父类实现了接口可序列化.

I go to Settings -> Errors -> Serialization issues -> Serializable class without ‘serialVersionUID’, but it still doesn't show me the warning. My class PKladrBuilding parent implements interface Serializable.

部分代码:

public class PKladrBuilding extends PRQObject

public abstract class PRQObject extends PObject

public abstract class PObject implements Serializable

推荐答案

我不确定您是否有旧版本的 IntelliJ IDEA,但如果我转到菜单 FileSettings...检查序列化问题 → 未启用serialVersionUID"的可序列化类,您提供的类给我警告.

I am not sure if you have an old version of IntelliJ IDEA, but if I go to menu FileSettings...InspectionsSerialization issues → Serializable class without 'serialVersionUID'` enabled, the class you provide give me warnings.

如果我尝试第一堂课,我会看到:

If I try the first class I see:

顺便说一句:直到我将 { } 添加到每个类的末尾以修复编译错误后,它才向我显示警告.

BTW: It didn't show me a warning until I added { } to the end of each class to fix the compile error.

这篇关于IntelliJ IDEA 生成 serialVersionUID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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