JavadocThrowsOrder
Since Checkstyle 14.1.0
Description
Checks that multiple
@throws and @exception Javadoc tags are listed alphabetically by exception name. No violation is reported for a tag without an exception name, or for duplicate exception names that are already in order.
Properties
| name | description | type | default value | since |
|---|---|---|---|---|
| violateExecutionOnNonTightHtml | Control when to print violations if the Javadoc being examined by this check violates the tight html rules defined at Tight-HTML Rules. | boolean | false |
14.1.0 |
Examples
To configure the default check:
<module name="Checker">
<module name="TreeWalker">
<module name="JavadocThrowsOrder"/>
</module>
</module>
Example:
class Example1 {
/**
* Correct order.
* @throws IllegalArgumentException if input is invalid.
* @exception NullPointerException if input is null.
*/
void validOrder() {}
// violation 5 lines below """@throws tag for 'IOException' should be
// placed alphabetically before 'SecurityException'."""
/**
* Incorrect order.
* @exception SecurityException if security check fails.
* @throws IOException if an I/O error occurs.
*/
void invalidOrder() throws IOException {}
}
Example of Usage
Violation Messages
All messages can be customized if the default message doesn't suit you. Please see the documentation to learn how to.
Fully Qualified Name
com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocThrowsOrderCheck
Use this fully qualified class name in configuration when an exact class reference is required.






