MultilineCommentLeadingAsteriskPresence
Since Checkstyle 13.3.0
Description
Checks that all lines in a multi-line block comment start with
a leading asterisk (*), as required by the
Google Java Style Guide §4.8.6.
For multi-line block comments, subsequent lines must start with * aligned with the * on the previous line. This check does not apply to single-line block comments (/* comment */).
Parent is com.puppycrawl.tools.checkstyle.TreeWalker
Violation Message Keys:
-
multiline.comment.missing.asterisk
Examples
To configure the check:
<module name="Checker">
<module name="TreeWalker">
<module name="MultilineCommentLeadingAsteriskPresence"/>
</module>
</module>
Example:
class Example1 {
// OK: Single-line block comment
/* This is fine */
// OK: Multi-line with asterisks
/*
* This is correct.
* Each line has asterisk.
*/
void method1() { }
// violation below 'Line in block comment should start with '*''
/*
First line missing asterisk.
* Second line OK.
*/
void method2() { }
// violation 2 lines below 'Line in block comment should start with '*''
/*
* First line OK.
Second line missing asterisk.
*/
void method3() { }
}
Example of Usage
Violation Messages
All messages can be customized if the default message doesn't suit you. Please see the documentation to learn how to.
Package
com.puppycrawl.tools.checkstyle.checks.whitespace






