RFR: 8352389: Remove incidental whitespace in pre/code content [v3]

Hannes Wallnöfer hannesw at openjdk.org
Tue Apr 8 17:53:14 UTC 2025


On Tue, 8 Apr 2025 17:22:24 GMT, Chen Liang <liach at openjdk.org> wrote:

>> Hannes Wallnöfer has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 14 commits:
>> 
>>  - Merge branch 'master' into JDK-8352389
>>  - Improve test
>>  - Add comment
>>  - 8352389: Remove incidental whitespace in pre/code content
>>  - Whitespace normalization in PrettyCheck becomes simpler
>>  - Rename method
>>  - Update comment
>>  - Clean up code, add comments, tests and @bug id
>>  - Updated copyright year in testSourceTab breaks test
>>  - Update remaining doctree tests & copyright headers
>>  - ... and 4 more: https://git.openjdk.org/jdk/compare/fb210e3a...5ec3bc04
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/parser/DocCommentParser.java line 1309:
> 
>> 1307:         for (var tree : trees) {
>> 1308:             var visited = visitor.visit(tree, cx);
>> 1309:             if (visited != null) {
> 
> Should we just fail if `visited == null`? Can it happen with any user input?

I should have added a comment here: returning `null` from the visitor method means this tree should be dropped from the result. This happens for whitespace-only text between `<pre>` and `<code>` and is part of successful normalization.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24112#discussion_r2033743314


More information about the compiler-dev mailing list