Class ModifierOrderCheck

  • All Implemented Interfaces:
    Configurable, Contextualizable

    public class ModifierOrderCheck
    extends AbstractCheck

    Checks that the order of modifiers conforms to the suggestions in the Java Language specification, sections 8.1.1, 8.3.1 and 8.4.3. The correct order is:

    1. public
    2. protected
    3. private
    4. abstract
    5. default
    6. static
    7. final
    8. transient
    9. volatile
    10. synchronized
    11. native
    12. 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.

    An example of how to configure the check is:

     <module name="ModifierOrder"/>
     
    Author:
    Lars Kühne