Since Checkstyle 6.0
Note: Google used the term "at-clauses" for block tags in their guide till 2017-02-28.
name | description | type | default value | since |
---|---|---|---|---|
tagOrder | Specify the order by tags. | String[] | @author, @deprecated, @exception, @param, @return, @see, @serial, @serialData, @serialField, @since, @throws, @version |
6.0 |
target | Specify block tags targeted. | subset of tokens TokenTypes | CLASS_DEF , COMPACT_CTOR_DEF , CTOR_DEF , ENUM_DEF , INTERFACE_DEF , METHOD_DEF , RECORD_DEF , VARIABLE_DEF | 6.0 |
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 |
8.3 |
To configure the default check:
<module name="Checker"> <module name="TreeWalker"> <module name="AtclauseOrder"/> </module> </module>
Example:
/** * Some javadoc. * * @author Some javadoc. * @version Some javadoc. * @param Some javadoc. * @return Some javadoc. * @throws Some javadoc. * @exception Some javadoc. * @see Some javadoc. * @since Some javadoc. * @serial Some javadoc. * @serialField * @serialData */ public class Example1 {} class Valid1 implements Serializable {} /** * Some javadoc. * * @since Some javadoc. * @version Some javadoc. // violation * @deprecated * @see Some javadoc. // violation */ class Invalid1 implements Serializable {} /** * Some javadoc. * * @since Some javadoc. * @version Some javadoc. // violation * @deprecated * @see Some javadoc. // violation * @author max // violation */ enum Test1 {}
To configure the check such that it checks in the custom order:
<module name="Checker"> <module name="TreeWalker"> <module name="AtclauseOrder"> <property name="tagOrder" value="@author, @since, @version, @param, @return, @throws, @exception, @deprecated, @see, @serial, @serialField, @serialData"/> </module> </module> </module>
Example:
/** * Some javadoc. * * @author Some javadoc. * @version Some javadoc. * @param Some javadoc. * @return Some javadoc. * @throws Some javadoc. * @exception Some javadoc. * @see Some javadoc. * @since Some javadoc. // violation * @serial Some javadoc. * @serialField * @serialData */ public class Example2 {} class Valid2 implements Serializable {} /** * Some javadoc. * * @since Some javadoc. * @version Some javadoc. * @deprecated * @see Some javadoc. */ class Invalid2 implements Serializable {} /** * Some javadoc. * * @since Some javadoc. * @version Some javadoc. * @deprecated Some javadoc. * @see Some javadoc. * @author max // violation */ enum Test2 {}
To configure the check such that it targets only enums:
<module name="Checker"> <module name="TreeWalker"> <module name="AtclauseOrder"> <property name="target" value="ENUM_DEF"/> <property name="tagOrder" value="@author, @since, @version, @param, @return, @throws, @exception, @deprecated, @see, @serial, @serialField, @serialData"/> </module> </module> </module>
Example:
/** * Some javadoc. * * @author Some javadoc. * @version Some javadoc. * @param Some javadoc. * @return Some javadoc. * @throws Some javadoc. * @exception Some javadoc. * @see Some javadoc. * @since Some javadoc. * @serial Some javadoc. * @serialField * @serialData */ public class Example3 {} class Valid3 implements Serializable {} /** * Some javadoc. * * @since Some javadoc. * @version Some javadoc. * @deprecated * @see Some javadoc. */ class Invalid3 implements Serializable {} /** * Some javadoc. * * @since Some javadoc. * @version Some javadoc. * @deprecated * @see Some javadoc. * @author Some javadoc. // violation */ enum Test3 {}
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.javadoc