RFR: 8358066: Non-ascii package names gives compilation error "import requires canonical name" [v2]
Archie Cobbs
acobbs at openjdk.org
Mon Jun 2 19:05:37 UTC 2025
On Mon, 2 Jun 2025 18:02:16 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:
>> Archie Cobbs has updated the pull request incrementally with two additional commits since the last revision:
>>
>> - Fix glitch in exception message.
>> - Simplify code using review suggestion.
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/util/Convert.java line 231:
>
>> 229: off += nbytes;
>> 230: len -= nbytes;
>> 231: numChars++;
>
> I wonder if it wouldn't be easier to simply ignore bytes from `buf` in the form of `0b10xxxxxx`? E.g. something along these lines:
> Suggestion:
>
> int byte1 = buf[off++];
> if ((byte1 & 0b11000000) != 0b10000000) {
> //only count the first byte in every encoded sequence,
> //and ignore the other:
> numChars++;
> }
Nice! Thanks, fixed in 91a9037f434. FYI I used `0x` instead of `0b` to stay consistent with the rest of the class.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25567#discussion_r2121942187
More information about the compiler-dev
mailing list