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

╄→尐↘猪︶ㄣ 提交于 2019-12-10 14:13:19

问题


I am trying to add a JavaDoc in my code. I need to add multiple exception in a single throw. When I add below, it only recognizes NullPointerException not the 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?

@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

回答1:


You cannot specify 2 exceptions with 1 @throws tag


You need a @throws tag for each exception you have. This allows you to give a description for each exception you are throwing.



来源:https://stackoverflow.com/questions/29720930/how-can-i-have-multiple-exception-in-a-single-throw-java-docs-tag

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