问题
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