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

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

问题描述

我的问题是如何在IDEA中生成此值?我转到设置 - >错误 - >序列化问题 - > Serializable类没有'serialVersionUID',但它仍然没有显示警告。我的类PKladrBuilding父实现了接口Serializable

My question is how to generate this value in IDEA? I go to Settings -> Errors -> Serialization issues -> Serializable class without ‘serialVersionUID’ but it still dont 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,但如果我去 File =>设置... =>检查=>序列化问题=>启用了serialVersionUID的可序列化类,您提供的类会给我警告。

I am not sure if you have an old version of IntelliJ but If I go File => Settings... => Inspections => Serialization issues => Serializable class without 'serialVersionUID' enabled, the class you provide give me warnings.

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

If I try the first class I see

BTW直到我在每个类的末尾添加 {} 来修复编译错误之后才向我显示警告。

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天全站免登陆