serialVersionUID field warning in eclipse

南楼画角 提交于 2019-12-05 00:59:00

Eclipse used to have that warning disabled by default. In Eclipse Indigo (3.7), the default was to enable the warning. You can change the setting in 2 places, one for everything in the workspace, and one for a single project.

To disable the warning for all projects in the workspace, go to Window / Preferences and open the Java / Compiler / "Errors/Warnings" tab, and open "Potential programming problems", then change the value of "Serializable class without serialVersionUID" to Ignore (or whatever you think is appropriate).

To disable the warning for a single project, you can right-click on the project, select Properties, then go to Java Compiler / "Errors/Warnings", click Enable project specific settings (if necessary), then select "Potential programming problems" and change the value of "Serializable class without serialVersionUID" to Ignore (or whatever you think is appropriate).

TestGUI extends Frame which in turn implements Serializable. A requirement of the Serializable interface is to have a final long serialVersionUID field. See the Serializable javadoc for more info.

To quote the important part of that Javadoc:

...it is strongly recommended that all serializable classes explicitly declare
serialVersionUID values, since the default serialVersionUID computation is highly
sensitive to class details that may vary depending on compiler implementations...
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!