Skip to content

Commit

Permalink
Improve NotJavadoc docs
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 538887501
  • Loading branch information
cushon authored and Error Prone Team committed Jun 8, 2023
1 parent 1e3f53d commit 03dc338
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

/** A BugPattern; see the summary. */
@BugPattern(
summary = "Avoid using /** for comments which aren't actually Javadoc.",
summary = "Avoid using `/**` for comments which aren't actually Javadoc.",
severity = WARNING,
documentSuppression = false)
public final class NotJavadoc extends BugChecker implements CompilationUnitTreeMatcher {
Expand Down
14 changes: 13 additions & 1 deletion docs/bugpattern/javadoc/NotJavadoc.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
This comment starts with `/**`, but isn't actually Javadoc.

Consider making it a single-line `//` or a multi-line `/*` comment instead.
Javadoc comments
[must precede a class, field, constructor, or method declaration](https://www.oracle.com/technical-resources/articles/java/javadoc-tool.html#format).

Using `/**` comments in locations where Javadoc is not supported is confusing
and unnecessary.

Suggested solutions:

* If the comment is intended to be part of the API documentation, move it to
the appropriate class, field, constructor, or method declaration.

* If the comment is intended to be an implementation comment, use a
single-line `//` or a multi-line `/*` comment instead.

## Suppression

Expand Down

0 comments on commit 03dc338

Please sign in to comment.