RFR: 8367129: Move input validation checks to Java for java.lang.StringLatin1 intrinsics [v4]
Raffaello Giulietti
rgiulietti at openjdk.org
Mon Feb 16 14:53:21 UTC 2026
On Fri, 13 Feb 2026 18:17:50 GMT, Volkan Yazici <vyazici at openjdk.org> wrote:
>> Moves input validation checks to Java for `java.lang.StringLatin1` intrinsics. While doing so, affected `java.lang.StringUTF16` methods needed to be updated due to relaxed checks at intrinsics. The javadocs of the touched methods are extensively overhauled.
>
> Volkan Yazici has updated the pull request incrementally with one additional commit since the last revision:
>
> More `indexOf` et al. guards and other review feedback
src/java.base/share/classes/java/lang/StringLatin1.java line 475:
> 473: return 0;
> 474: }
> 475: if (value.length == 0) {
These checks could be removed altogether, and instead rely on those in the invoked method.
Alternatively, this line could be
Suggestion:
if (value.length < str.length) {
to match https://github.com/openjdk/jdk/pull/28832/changes#diff-0429b143c93fceff618ecb5bb78b584f2b2ea4771241c7dd450ddb9151c1c515R511 more closely.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28832#discussion_r2812779334
More information about the core-libs-dev
mailing list