RFR: 8352389: Remove incidental whitespace in pre/code content

Hannes Wallnöfer hannesw at openjdk.org
Wed Mar 19 11:31:51 UTC 2025


Please review a change to remove incidental whitespace commonly found at the beginning of `<pre><code>` or `<pre>{@code` tags. This patch is dependent on [JDK-8352249](https://bugs.openjdk.org/browse/JDK-8352249) and completes the removal of incidental whitespace in traditional doc comments. 

This is implemented by parsing content of `<pre>` elements into a separate list buffer in `DocCommentParser`, and filter the content for leading blank linkes when the element is closed. The decision to filter `<pre>` element contents only once the element is closed was made in order to be able to keep the logic in a single method without further complicating other parts of `DocCommentParser`.

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

Depends on: https://git.openjdk.org/jdk/pull/24032

Commit messages:
 - Improve test
 - Add comment
 - 8352389: Remove incidental whitespace in pre/code content

Changes: https://git.openjdk.org/jdk/pull/24112/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=24112&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8352389
  Stats: 354 lines in 7 files changed: 342 ins; 3 del; 9 mod
  Patch: https://git.openjdk.org/jdk/pull/24112.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/24112/head:pull/24112

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


More information about the compiler-dev mailing list