Please review: surrogate fiddle (original) (raw)

Masayoshi Okutsu masayoshi.okutsu at oracle.com
Tue Mar 19 02:44:08 UTC 2013


Thank you for catching this bug. AbstractStringBuilder.codePointAt(int) should have called Character.codePointAt(char[], int, int).

As for duplicating code, I originally duplicated similar code everywhere for performance. But someone told me probably during code review that hotspot inlining was as good as C/C++ macros, and I agreed to replace the duplicated code with method calls.

Masayoshi

On 3/19/2013 7:13 AM, Martin Buchholz wrote:

It does change the behavior. The existing behavior is clearly a bug, since it reads a char that should be inaccessible. I don't believe AIOOBE exception is thrown, with or without my fix.

On Mon, Mar 18, 2013 at 3:08 PM, Mike Duigou <mike.duigou at oracle.com> wrote: This change would seem to change the result when a high surrogate is the last char in the String/StringBuilder/StringBuffer.

Rather than throwing an ArrayIndexException it will return the high surrogate char. I am going to defer to Sherman on this. I don't know that returning the character is the right thing to do. Sherman? Mike On Mar 18 2013, at 14:28 , Martin Buchholz wrote: Hello Jim, Mike, I'd like you to do a code review: http://cr.openjdk.java.net/~martin/webrevs/openjdk8/surrogate-fiddle/



More information about the core-libs-dev mailing list