RFR: JDK-8300914: Allow `@` as an escape in documentation comments [v2]

Pavel Rappo prappo at openjdk.org
Thu Feb 2 14:21:53 UTC 2023


On Wed, 1 Feb 2023 19:43:00 GMT, Jonathan Gibbons <jjg at openjdk.org> wrote:

>> Please review a moderately simple update to permit the use of `@` as the escape character in a limited set of escape sequences.
>
> Jonathan Gibbons has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains two commits:
> 
>  - Merge with upstream/master
>  - JDK-8301294: Allow `@` as an escape in documentation comments

FWIW, I ran our CI with this PR and the run was green.

src/jdk.compiler/share/classes/com/sun/tools/javac/parser/DocCommentParser.java line 231:

> 229: 
> 230:                 case '@':
> 231:                     if (newline) {

Here and on L250: why do you set `newline` unconditionally immediately after reading a character?

test/langtools/tools/javac/doctree/AtEscapeTest.java line 39:

> 37:     /**
> 38:      * abc
> 39:      * @@tag

I'd add a couple of tests to assert that `@@` and `@*` also work in the middle of a line. Unlike `@/`, which requires preceding `*`, `@@` and `@*` do not require preceding whitespace. That seems useful. In particular, `@@` could be used in the middle of a line for robustness. For example, one could prepend plaintext `@Override` in the middle of a line with an extra `@` to defend against text reflow that brings `@Override` to the beginning of a line.

-------------

PR: https://git.openjdk.org/jdk/pull/12372


More information about the compiler-dev mailing list