Should I use a “non-Javadoc” comment?

冷暖自知 提交于 2019-12-21 06:56:13

问题


I implemented my own method defined in an interface. However when I try to add Javadoc to this method Eclipse gave me a comment like this:

/* (non-Javadoc)
 * @see javax.servlet.ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent)
 */

Actually, I really need to add some comment to this method. What should I do?


回答1:


The idea of adding a non-javadoc comment here is that in the generated javadoc the comment from the inherited method will be copied, which might be enough - and better than if you had an empty /** */ comment. At the same time, you can use the link in the source code to look up the method. And as said by Ken, you can always change it.

If you want to include the interface's documentation, use {@inheritDoc} in your comment.




回答2:


Eclipse gave you something, but you can feel free to change it. Change it into a javadoc comment by adding the second star to make it a /** at the beginning, then write whatever you want just like you do with the other javadoc comments. Eclipse won't get in your way or insist you change things back -- it's just giving you some boilerplate to work with.



来源:https://stackoverflow.com/questions/6338266/should-i-use-a-non-javadoc-comment

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