john
john

Reputation: 11679

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

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

Upvotes: 10

Views: 6479

Answers (1)

Vince
Vince

Reputation: 15146

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.

Upvotes: 20

Related Questions