RFR: 8332858: References with escapes have broken positions after they are transformed

Vicente Romero vromero at openjdk.org
Tue May 28 19:10:06 UTC 2024


On Tue, 28 May 2024 18:27:04 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:

>> src/jdk.internal.md/share/classes/jdk/internal/markdown/MarkdownTransformer.java line 858:
>> 
>>> 856:                     for (char c : ref.toCharArray()) {
>>> 857:                         if (Escaping.ESCAPABLE.indexOf(c) >= 0) {
>>> 858:                             pattern.append("\\\\?");
>> 
>> suggestion, dunno how critical is this code but regex usually are a tax on performance, I would consider not using them
>
> Sorry for the belated answer. Yes, regexps are usually not very performant, but it is only happening when the exact match fails. And, hopefully, the regexp should not be too difficult to handle. I was considering writing the search by hand, and I can, but it seems like a lot of code to handle a case like this. I can write the search manually, though.

ok if you think they won't be a problem in this case, I'm fine with it, we can always refactor the code if needed

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19387#discussion_r1617772235


More information about the compiler-dev mailing list