alhudz commented on PR #1725:
URL: https://github.com/apache/commons-lang/pull/1725#issuecomment-4787569381

   My fault on that one. I only had a single JDK in front of me last time and 
`String` happened to fold there, so the bad gate slipped through.
   
   The behaviour isn't actually a Java 8 vs 9 split. 
`String.regionMatches(true, ...)` only started folding a supplementary code 
point at the code point level somewhere after 11: it returns `false` on 8 and 
11, and `true` on 21/26. So gating on `IS_JAVA_1_8` was wrong, it folded on 11 
where `String` itself still doesn't.
   
   Rather than pin the exact cutover version, I now probe once at class load 
what `String` actually does and only fold when it does, so the non-String path 
tracks `String` on whatever JDK is running.
   
   Checked it properly this time: `CharSequenceUtilsTest` is green on 11, 21 
and 26, and a parity run of `StringBuilder`/`StringBuffer`/`CharBuffer` against 
`String` over ~6M random BMP/supplementary/lone-surrogate inputs gives 0 
divergence on each. Java 8 takes the same no-fold path as 11.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to