inexplicable Netbeans serializable warning for nested base class

倾然丶 夕夏残阳落幕 提交于 2019-12-11 09:24:56

问题


When I define the following class

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

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.


回答1:


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

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.



来源:https://stackoverflow.com/questions/6078806/inexplicable-netbeans-serializable-warning-for-nested-base-class

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!