RFR: 8332858: References with escapes have broken positions after they are transformed
Jonathan Gibbons
jjg at openjdk.org
Tue May 28 22:12:01 UTC 2024
On Fri, 24 May 2024 09:05:20 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:
> If the javadoc comment contains a (Markdown) link like:
>
> [java.util.Arrays#asList(Object[])]
>
>
> The transformer that converts this link into the Javadoc link will not find the reference, as it is looking for `java.util.Arrays#asList(Object[])` (note the missing escapes), which is not present in the original text.
>
> This patch tries to fix that by permitting optional escapes for all escapable character when searching for the reference, in case the literal search fails. This is done using regexp, although could presumably be done using a manual search.
Changes requested by jjg (Reviewer).
src/jdk.internal.md/share/classes/jdk/internal/markdown/MarkdownTransformer.java line 38:
> 36: import com.sun.source.doctree.DocTree;
> 37: import com.sun.source.doctree.DocTreeVisitor;
> 38: import com.sun.source.doctree.EscapeTree;
Not sure why you need this.
src/jdk.internal.md/share/classes/jdk/internal/markdown/MarkdownTransformer.java line 65:
> 63: import static com.sun.tools.javac.util.Position.NOPOS;
> 64: import java.util.regex.Matcher;
> 65: import jdk.internal.org.commonmark.internal.util.Escaping;
imports out of order
-------------
PR Review: https://git.openjdk.org/jdk/pull/19387#pullrequestreview-2083909861
PR Review Comment: https://git.openjdk.org/jdk/pull/19387#discussion_r1617930345
PR Review Comment: https://git.openjdk.org/jdk/pull/19387#discussion_r1617930520
More information about the compiler-dev
mailing list