Where do I change the setting in Eclipse so that i

2019-02-25 17:03发布

I want Eclipse to generate a serialVersionUID for classes that implement Serializable.

However, my Eclipse instance does not throw me a warning or an error when I create a class that implements Serializable. Also, it does not give an suggestion about adding a generated serialVersionUID. Where do I change the required setting?

1条回答
欢心
2楼-- · 2019-02-25 18:01

To turn on warning for Serializable class without a serialVersionID, go to Window > Preference > Java > Compiler > Errors/Warnings and search for Serializable class without a serialVersionID. Set that to Error or Warning based on your preference.

Once warning for "[class] does not declare a static final serialVersionUID field of type long" are thrown you can click on the serialization class and press CTRL + 1.

查看更多
登录 后发表回答