RFR: 8338257: UTF8 lengths should be size_t not int [v5]

Dean Long dlong at openjdk.org
Tue Aug 27 07:58:05 UTC 2024


On Tue, 27 Aug 2024 07:23:14 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> src/hotspot/share/classfile/javaClasses.cpp line 633:
>> 
>>> 631: }
>>> 632: 
>>> 633: int java_lang_String::utf8_length_as_int(oop java_string, typeArrayOop value) {
>> 
>> Why not call java_lang_String::utf8_length() here instead of duplicating the code?
>
> Because we have to call `UNICODE::utf8_length_as_int` to get the proper truncation - the code is not an exact duplicate.

OK, I missed that.  It's probably not worth it to refactor out the common code using C++ lambda expressions.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20560#discussion_r1732331731


More information about the serviceability-dev mailing list