Currently, ModifiedUtf.utfLen returns a signed int. For giant strings, this may overflow and produce negative values, causing incorrect behavior in code that depends on the UTF length.
Changing the return type to long would fully solve the problem or keep the return type as int to preserve API compatibility and add explicit overflow checks at call sites (e.g., writeUTFInternal) to safely handle giant strings.
Changing the return type to long would fully solve the problem or keep the return type as int to preserve API compatibility and add explicit overflow checks at call sites (e.g., writeUTFInternal) to safely handle giant strings.