On Thu, 12 Feb 2026 16:09:45 GMT, Volkan Yazici <[email protected]> wrote:
>> src/java.base/share/classes/java/lang/StringLatin1.java line 172: >> >>> 170: Objects.requireNonNull(other); >>> 171: String.checkOffset(len1, length(value)); >>> 172: String.checkOffset(len2, length(other)); >> >> Are these additional checks? I'm asking because I was expecting them to >> "replace" intrinsics ones but couldn't find where/how (if so I'm also >> wondering why they were not there before: did all callers ensure that?). > >> Are these additional checks? > > Yes. I'm exercising _"Always validate all input at the Java wrapper"_ stated > in the parent issue [JDK-8156534]. > >> I'm asking because I was expecting them to "replace" intrinsics ones but >> couldn't find where/how > > Note the Javadoc of `ArraysSupport#mismatch(byte[] a, byte[] b, int length)`: > > This method does not perform bounds checks. It is the responsibility > of the caller to perform such bounds checks before calling this method. > > AFAICT, `ArraysSupport` should be updated to validate its inputs too. But > that is for another day. > >> I'm also wondering why they were not there before: did all callers ensure >> that? > > Yes, pretty much accidentally. > > [JDK-8156534]: https://bugs.openjdk.org/browse/JDK-8156534 Thanks for the clarification @vy. A bit scary if it was really accidental. Anyway, C2 should fold the check if unnecessary but maybe a performance check before and after could be nice (just to be on the safe side). ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/28832#discussion_r2804280137
