我可以在 Javadoc 中对同一个异常使用多个 @throws 标记吗?

发布于 2025-01-04 13:49:08 字数 249 浏览 4 评论 0原文

如果我的应用程序由于多种原因引发相同的异常,我可以使用多个 @throws javadoc 标记吗?例如:

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

JavaDoc标准是否禁止?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

云归处 2025-01-11 13:49:08

它在 java 6,7 和 8 中有效。请参阅文档:

可以在给定的文档注释中使用多个@throws标签来针对相同或不同的异常。

(强调我的)

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

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

(emph. mine)

隔纱相望 2025-01-11 13:49:08

刚刚对此进行了测试,生成的 JavaDoc 包含所有 3 个 @throw。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文