The more complex the code gets, it's harder to think of all unchecked exceptions that method can throw.
Where you see a problem, I see a very good reason to keep your code simple ;-)
In your exemple, I'd suggest to document the ArrayIndexOutOfBoundsException
. Just because that's something someone can have when giving a bad parameter to you method, and it should be written somewhere : "If you given an invalid array index, you'll get an ArrayIndexOutOfBoundsException
. For example, the String#charAt()
method documents it can throw an IndexOutOfBoundException
if the index isn't valid.
In general, you shouldn't document al the exceptions that can arise. You can't predict them all, and you're very likely to forget one. So, document the obvious ones, the one you though of. Try to list the most exceptions as possible, but don't spend to much time on it. After all, if you forget one that should be documented, you can improve your documentation later.