RFR: 8356411: Comment tree not reporting correct position for label
Andrey Turbanov
aturbanov at openjdk.org
Tue Aug 19 14:18:38 UTC 2025
On Tue, 19 Aug 2025 11:57:45 GMT, Hannes Wallnöfer <hannesw at openjdk.org> wrote:
> Please review a change to fix the reported position of the label in `@see` tags in Markdown doc comments. When `MarkdownTransformer` would process the label of a `@see` tag together with the leading reference, it would set the position of the label to the position immediately following the reference, losing the actual source position of the label. The solution is to process the label without the leading reference.
>
> I have looked for other standard tags that may be affected by similar problems, but the `@see` tag is the only tag that [supports multiple forms](https://docs.oracle.com/en/java/javase/24/docs/specs/javadoc/doc-comment-spec.html#see) where Markdown text is stored in a list together with non-Markdown arguments.
>
> The two tests are slightly redundant, but they test slightly different aspects of the fix and they were easy to implement in their respective frameworks.
src/jdk.internal.md/share/classes/jdk/internal/markdown/MarkdownTransformer.java line 365:
> 363: var ref = tree.reference;
> 364: var hasReference = !ref.isEmpty() && ref.getFirst().getKind() == DocTree.Kind.REFERENCE;
> 365: List<DCTree> transformed = new ArrayList<>();
Suggestion:
List<DCTree> transformed = new ArrayList<>();
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26842#discussion_r2285420587
More information about the compiler-dev
mailing list