Can I use multiple @throws tags for the same exception in Javadoc?

好久不见. 提交于 2019-12-23 09:26:28

问题


Can I use multiple @throws javadoc tags if my application throws the same exception for multiple reasons? For example:

@throws UserException if issue 1 happened
@throws UserException if issue 2 happened
@throws UserException if issue 3 happened

Is it prohibited by JavaDoc standard?


回答1:


It is valid in java 6,7 and 8. See the docs:

  • Javadoc 6
  • Javadoc 7
  • Javadoc 8

Multiple @throws tags can be used in a given doc comment for the same or different exceptions.

(emph. mine)




回答2:


Just tested this the generated JavaDoc contains all 3 @throws.



来源:https://stackoverflow.com/questions/9229991/can-i-use-multiple-throws-tags-for-the-same-exception-in-javadoc

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