> Please review a patch to remove incidental indentation from traditional doc 
> comments. This adds a `stripIndent()` method to the `Tokens.Comment` 
> interface and a new `JavadocTokenizer.StrippedComment` nested class that 
> implements indentation stripping while maintaining a map of position offsets 
> to the original comment. 
> 
> While the patch changes `javadoc` output by removing leading whitespace, the 
> change is generally not visible in the browser except in `<pre>` elements, 
> which is the point of this enhancement. 
> 
> The change affects most tree positions in the AST checker tests in 
> javac/doctree, but mostly does not affect the structure of the parsed trees, 
> with the exception of `BreakIterator` tests in `FirstSentenceTest.java`. 
> 
> `BreakIterator` does not recognize `.\n` immediately followed by a lower case 
> letter as sentence break, while it recognizes the break if the letter is an 
> upper-case letter *or* if there is a space between the line break and the 
> letter. I find this rule a bit peculiar but AFAICT we can't influence the 
> behavior of `BreakIterator`, so I have added tests that cover both lower and 
> upper-case behavior.
> 
> The source position lookup in the stripped comment is implemented by creating 
> a new `OffsetMap` that translates from the stripped to the original comment, 
> then using the original comment's `OffsetMap` to translate the position to 
> the source file. `OffsetMap` is relatively lightweight (usually 2 `int[]` 
> elements per comment paragraph), so the added overhead is not too bad. 
> 
> Inspired by [JDK-8305688](https://bugs.openjdk.org/browse/JDK-8305688) I did 
> various test builds with restricted jobs and memory settings, but didn't 
> notice any change in processing or memory overhead to API docs builds.

Hannes Wallnöfer has updated the pull request incrementally with one additional 
commit since the last revision:

  Whitespace normalization in PrettyCheck becomes simpler

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/24032/files
  - new: https://git.openjdk.org/jdk/pull/24032/files/eb9a090c..1c21de77

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=24032&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=24032&range=00-01

  Stats: 55 lines in 3 files changed: 0 ins; 48 del; 7 mod
  Patch: https://git.openjdk.org/jdk/pull/24032.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/24032/head:pull/24032

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

Reply via email to