问题
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