问题描述
这已成为我的宠儿。我编写了一个类,并实现了 Serializible
。然后eclipse警告我没有 serialVersionUID
,因此我选择 添加生成的serialVersionUID 或 添加默认的serialVersionUID ,而我最终得到的是这样的东西:
This has become a pet peeve of mine. I write a class, and implement Serializible
. Then eclipse warns me that I don't have a serialVersionUID
, so I select "Add generated serialVersionUID" or "Add default serialVersionUID" and I end up with something like this:
/**
*
*/
private static final long serialVersionUID = 4049849541314027178L;
大多数时候,我不想添加评论,所以我必须删除评论。我希望默认值是不加评论,但是我在首选项中仔细查看了代码模板,还没有弄清楚如何更改它。我只是希望它看起来像这样:
Most of the time I don't want to add a comment, so I have to go and delete the comment. I would rather the default be no comment, but I've looked through the code templates in preferences and haven't figured out how to change this. I simply want it to look like this:
private static final long serialVersionUID = 4049849541314027178L;
推荐答案
它正在将模板用于任何由Eclipse生成的字段。
It's using the template for any eclipse-generated field.
您可以在
Preferences ->
Java ->
Code Style ->
Code Templates ->
Comments ->
Fields
...全局或按项目。
... either globally or per-project.
这篇关于摆脱上面Eclipse生成的serialVersionUID的注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!