RFR: 8338525: leading and trailing code blocks by indentation
Jonathan Gibbons
jjg at openjdk.org
Wed Sep 11 22:40:22 UTC 2024
Please review these changes to correct the handling of leading and trailing indented code blocks in a doc comment.
There are two separate issues here: one for leading indented code blocks and one for trailing indented code blocks.
1. Leading indented code blocks: the code to detect the first sentence of a doc comment is modified to detect whether the comment begins with an indented code block. If it does, the first sentence is deemed to be empty, and the body of the doc comment begins with the code block.
2. Trailing indented code blocks: the content of the indented code block is marked as significant by updating `lastNonWhite`, which will cause the content to be recorded (not dropped) if the code block is followed by EOF.
For both cases, simple `DocTree` AST-level tests are provided, as well as full `JavadocTester` tests, that test the end-user view of the generated docs.
-------------
Commit messages:
- JDK-8338525: leading and trailing code blocks by indentation
Changes: https://git.openjdk.org/jdk/pull/20956/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=20956&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8338525
Stats: 128 lines in 4 files changed: 109 ins; 14 del; 5 mod
Patch: https://git.openjdk.org/jdk/pull/20956.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/20956/head:pull/20956
PR: https://git.openjdk.org/jdk/pull/20956
More information about the javadoc-dev
mailing list