嵌套基类的莫名其妙的Netbeans可序列化警告 [英] inexplicable Netbeans serializable warning for nested base class

查看:135
本文介绍了嵌套基类的莫名其妙的Netbeans可序列化警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我定义以下类时

public class Outer extends Outer.Inner {
    public static class Inner { }
}

Netbeans 6.9.1为我提供了内部和外部"警告没有对serialVersionUID的定义".我想知道此警告是否有正当理由,或者是否是错误.扩展内部类会使编译器认为他们正在实现Serializable?

Netbeans 6.9.1 gives me the "has no definition of serialVersionUID" warning for both Outer and Inner. I'm wondering if there is a legit reason for this warning, or if it's a bug. What about extending an inner class makes the compiler think they are implementing Serializable?

注意:这更多是出于好奇,而不是想要这种不必要的设计模式.

Note: This is more out of curiosity than wanting this unnecessary design pattern.

推荐答案

我自己也想知道同样的事情.代替了答案,我关闭了警告.

I've wondered the same thing myself. In lieu of an answer, I turned off the warning.

工具->选项菜单 提示选项卡->标准Javac警告 取消选中序列化复选框.

Tools -> Options Menu Hints Tab -> Standard Javac warnings Uncheck the serialization checkbox.

现在,在扩展序列化对象时,您必须要小心,但是它不会使您烦恼未序列化的事物.

Now you'll have to be careful when extending Serialized Objects, but it stops annoying you about things that aren't serialized.

这篇关于嵌套基类的莫名其妙的Netbeans可序列化警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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