Skip to content

Commit 25c361a

Browse files
java-team-github-botError Prone Team
authored and
Error Prone Team
committed
Suggest using code as per[]
PiperOrigin-RevId: 551547582
1 parent 7af50cc commit 25c361a

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

docs/bugpattern/javadoc/InvalidBlockTag.md

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,31 @@ int twoTimes(int n) {
1818
}
1919
```
2020

21-
Note that any Javadoc line starting with `@`, even embedded inside `<pre>` and
22-
`{@code ...}`, is interpereted as a block tag by the Javadoc parser. As such, if
23-
you wish your Javadoc to include a code block containing an annotation, you
24-
should generally avoid `{@code ...}` and instead write the HTML yourself,
25-
manually escaping the `@` entity.
21+
Note that any Javadoc line starting with `@`, even embedded inside `<pre>` is
22+
interpreted as a block tag by the Javadoc parser. As such, if you wish your
23+
Javadoc to include a code block containing an annotation, you should surround
24+
the snippet with `{@code ...}`. Alternatively, and if you are using a version of
25+
javadoc prior to JDK 15, you may escape the symbol using `{@literal @}`
26+
27+
```java
28+
/**
29+
* Designed to be overridden, such as:
30+
*
31+
* <pre>{@code
32+
* class Foo {
33+
* @Override public String toString() {return "";}
34+
* }
35+
* }</pre>
36+
*/
37+
```
2638

2739
```java
2840
/**
2941
* Designed to be overridden, such as:
3042
*
3143
* <pre>
3244
* class Foo {
33-
* &#64;Override public String toString() {return "";}
45+
* {@literal @}Override public String toString() {return "";}
3446
* }
3547
* </pre>
3648
*/

0 commit comments

Comments
 (0)