RFR: JDK-8298405: Support Markdown in Documentation Comments [v6]
Jonathan Gibbons
jjg at openjdk.org
Tue Jan 30 00:31:46 UTC 2024
On Mon, 15 Jan 2024 18:08:54 GMT, Pavel Rappo <prappo at openjdk.org> wrote:
>> Jonathan Gibbons has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains seven additional commits since the last revision:
>>
>> - Merge with upstream/master
>> - Merge remote-tracking branch 'upstream/master' into 8298405.doclet-markdown-v3
>> - Address review comments
>> - Fix whitespace
>> - Improve handling of embedded inline taglets
>> - Customize support for Markdown headings
>> - JDK-8298405: Support Markdown in Documentation Comments
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/parser/DocCommentParser.java line 1336:
>
>> 1334: switch (initialLineKind) {
>> 1335: case CODE_FENCE -> {
>> 1336: if (lineKind == LineKind.CODE_FENCE && ch == term && count(ch) == count) {
>
> https://spec.commonmark.org/0.30/#example-124 shows that the closing fence may be longer than the opening one: consider `count(ch) >= count`.
>
> That said, I note that on my experiment the resulting output was identical with or without the change I ask you to consider. Perhaps I haven't yet understood how the parsing works.
Good catch. The spec has the words: _and with at least as many backticks or tildes_
Will fix.
> src/jdk.compiler/share/classes/com/sun/tools/javac/parser/DocCommentParser.java line 1421:
>
>> 1419: case '#', '=', '-', '+', '_', '`', '~' -> {
>> 1420: String line = peekLine();
>> 1421: for (LineKind lk : LineKind.values()) {
>
> Nothing wrong here, just noting that this is one more way one can depend on an enum constant order. Change it, and a peeked line kind might change too (e.g. `OTHER` matches everything.)
Like it or not, JLS defines that enum members are ordered, and even has an example 8.9.3-1 of using the `values` method in an enhanced `for` loop. Any change to the order of the members of any enum has the potential to be a breaking change and should never be done lightly. Curiously, JLS 13.4.26 does not say that reordering enum constants may break clients.
Anyway, I added comments to the LineKind enum declaration.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16388#discussion_r1470410143
PR Review Comment: https://git.openjdk.org/jdk/pull/16388#discussion_r1470408047
More information about the build-dev
mailing list