简体   繁体   English

如何在单个抛出java docs标记中有多个异常?

[英]How can I have multiple exception in a single throw java docs tag?

I am trying to add a JavaDoc in my code. 我想在我的代码中添加一个JavaDoc。 I need to add multiple exception in a single throw. 我需要在一次抛出中添加多个异常。 When I add below, it only recognizes NullPointerException not the IllegalArgumentException . 当我在下面添加时,它只识别NullPointerException而不是IllegalArgumentException Is there any way to provide multiple exception in a single throw tag so that it can recognize both, when I place my mouse on the method? 有什么方法可以在单个throw标签中提供多个异常,这样当我将鼠标放在方法上时它可以识别这两个异常吗?

@throws NullPointerException, IllegalArgumentException when invalid userId, timeout is passed

Or I need to do it like this? 或者我需要这样做? By this, I am repeating same comment twice. 通过这个,我重复两次相同的评论。

@throws NullPointerException when invalid userId, timeout is passed
@throws IllegalArgumentException when invalid userId, timeout is passed

You cannot specify 2 exceptions with 1 @throws tag 您不能使用1 @throws标记指定2个例外


You need a @throws tag for each exception you have. 你需要每个例外的@throws标签。 This allows you to give a description for each exception you are throwing. 这允许您为要抛出的每个异常提供描述。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM