Since Checkstyle 8.23
To configure the check:
<module name="Checker"> <module name="TreeWalker"> <module name="InvalidJavadocPosition"/> </module> </module>
The following code produces a violation because Javadocs should be before all annotations of the Javadoc's target:
@SuppressWarnings("serial") // violation below, 'Javadoc comment is placed in the wrong location' /** * This comment looks like Javadoc but it is at an invalid location. * Therefore, the text will not get into TestClass.html. * And, the check will produce a violation. */ public class Example1 { }
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