How to prevent the auto-generation of comments just for quick-fixing the serialVersionUID warning?

风格不统一 提交于 2019-12-25 03:22:28

问题


This Eclipse question is a response to "Getting rid of the comment above eclipse generated serialVersionUID," but so far the single answer (which addresses this linked question, and is accepted) applies to all comments.

But my question will be more specific (it is not a duplicate) - I want normal generation of comments for other fields, just no generation of the comment when you quick-fix the serializable warning by generating the field.

As what the accepted answer to the original question, the answerer stated that

It's using the template for any eclipse-generated field.

You can change it in

 Preferences -> 
     Java -> 
        Code Style -> 
           Code Templates -> 
              Comments -> 
                 Fields

and then blank out the pattern.

Though you can prevent comment generation (or change the comment template) for all fields, is there any way to prevent or change auto-comment-generation just for the serialVersionUID field?


回答1:


There isn't a way to prevent the auto-generation of comments for the SerialVersionUID through quick-fixing without blanking the comment generation template for all fields.

Nevertheless, it doesn't matter as simply blanking the comment template as addressed in the original question is sufficient, as the auto-generation applies to a very narrow range of scenarios, including this quick-fix.

The comment template is normally generated when you generate element comment from the Source either from the toolbar or by right-clicking the field, and that is entirely optional.



来源:https://stackoverflow.com/questions/51164187/how-to-prevent-the-auto-generation-of-comments-just-for-quick-fixing-the-serialv

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