Skip to content

Commit

Permalink
Document that javadoc shouldn't appear between annotations and the do…
Browse files Browse the repository at this point in the history
…cumented element

PiperOrigin-RevId: 591893421
  • Loading branch information
cushon authored and Error Prone Team committed Dec 18, 2023
1 parent d272dfa commit 21c190a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions docs/bugpattern/javadoc/NotJavadoc.md
Expand Up @@ -14,6 +14,23 @@ Suggested solutions:
* If the comment is intended to be an implementation comment, use a
single-line `//` or a multi-line `/*` comment instead.

> NOTE: Javadoc must appear before any annotations, or the compiler will fail to
> recognise it as Javadoc. That is, prefer this:
>
> ```java
> /** Might return a frobnicator. */
> @Nullable
> Frobnicator getFrobnicator();
> ```
>
> instead of this:
>
> ```java
> @Nullable
> /** Might return a frobnicator. */
> Frobnicator getFrobnicator();
> ```
## Suppression

Suppress by applying `@SuppressWarnings("NotJavadoc")` to the enclosing element.

0 comments on commit 21c190a

Please sign in to comment.