# Modifiers

- About
- Checkstyle
- Documentation
- Release Notes
- Configuration
- Property Types
- Running
- Ant Task
- Command Line
- Available Checks
- Standard Checks
- Javadoc Comments
- Naming Conventions
- Headers
- Imports
- Size Violations
- Whitespace
- Modifiers
- ModifierOrder
- RedundantModifier
- Block Checks
- Coding
- Class Design
- Duplicate Code
- Metrics
- Miscellaneous
- Optional Checks
- J2EE Checks
- Extending Checkstyle
- Writing checks
- Writing filters
- Writing listeners
- Javadoc
- SourceForge
- Mailing Lists
- Bug Database
- Feature Requests
- Developers
- Project Page
- SVN Repository
- Contributing

- Hosted by:

## ModifierOrder

### Description

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

### Example

To configure the check:

    <module name="ModifierOrder"/>

### Package

com.puppycrawl.tools.checkstyle.checks.modifier

### Parent Module

TreeWalker

## RedundantModifier

### Description

Checks for redundant modifiers in interface and annotation definitions. Also checks for redundant final modifiers on methods of final classes.

Rationale: The Java Language Specification strongly discourages the usage of "public" and "abstract" for method declarations in interface definitions as a matter of style.

Variables in interfaces and annotations are automatically public, static and final, so these modifiers are redundant as well.

As annotations are a form of interface, their fields are also automatically public, static and final just as their annotation fields are automatically public and abstract.

Final classes by definition can not be extended so the final modifier on the method of a final class is redundant.

### Properties

name | description | type | default value
--- | --- | --- | ---
tokens | tokens to check | subset of tokens METHOD_DEF, VARIABLE_DEF, ANNOTATION_FIELD_DEF | METHOD_DEF, VARIABLE_DEF, ANNOTATION_FIELD_DEF

### Example

To configure the check:

    <module name="RedundantModifier"/>

To configure the check to check only methods and not variables:

    <module name="RedundantModifier">
      <property name="tokens" value="METHOD_DEF"/>
    </module>

### Package

com.puppycrawl.tools.checkstyle.checks.modifier

### Parent Module

TreeWalker

Copyright © 2001-2007, Oliver Burn