Since Checkstyle 3.0
Checks that the order of modifiers conforms to the suggestions in the Java Language specification, § 8.1.1, 8.3.1, 8.4.3 and 9.4. The correct order is:
public
protected
private
abstract
default
static
sealed
non-sealed
final
transient
volatile
synchronized
native
strictfp
In additional, modifiers are checked to ensure all annotations are declared before all other modifiers.
Rationale: Code is easier to read if everybody follows a standard.
ATTENTION: We skip type annotations from validation.
To configure the check:
<module name="Checker"> <module name="TreeWalker"> <module name="ModifierOrder"/> </module> </module>
All messages can be customized if the default message doesn't suit you. Please see the documentation to learn how to.
com.puppycrawl.tools.checkstyle.checks.modifier