InvalidArgumentException
Description
- Derived from
An argument passed to a method has an illegal value.
Precondition constraints can be placed on method parameters by putting a special tag at the beginning of the corresponding parameter documentation:
-
[>n]
The parameter value must be greater than the given boundaryn
. -
[>=n]
The parameter value must be greater than or equal to the given boundaryn
. -
[<n]
The parameter value must be less than the given boundary. -
[<=n]
The parameter value must be less than or equal to the given boundary. -
[not-empty]
The parameter value must not be empty (e.g. empty strings, array or collections). -
[not-null]
The parameter value must not be null. -
[pow2]
The parameter value must be a power of two. -
[pow2+1]
The parameter value must be a power of two, plus one. -
[n..m]
The parameter value must lie within the given interval (both bounds are inclusive).
Method preconditions are only evaluated in DEBUG
mode. Passing a parameter value that violates a precondition constraint in RELEASE
mode will produce undefined results.
Each method of this class acts as a static factory method for creating an appropriate exception object for one of the above precondition constraints.
An InvalidArgumentException indicates a programming error, so this kind of exception is never documented explicitly, only implicitly via the precondition tags.