com.puppycrawl.tools.checkstyle.checks.modifier

Class ModifierOrderCheck

public class ModifierOrderCheck extends Check

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. static
  6. final
  7. transient
  8. volatile
  9. synchronized
  10. native
  11. 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

Method Summary
int[]getDefaultTokens()
{@inheritDoc}
voidvisitToken(DetailAST aAST)
{@inheritDoc}

Method Detail

getDefaultTokens

public int[] getDefaultTokens()
{@inheritDoc}

visitToken

public void visitToken(DetailAST aAST)
{@inheritDoc}