review request for 6798511/6860431: Include functionality of Surrogate in Character

Xueming Shen Xueming.Shen at Sun.COM
Wed Aug 26 18:02:44 UTC 2009


Ulf,

"get rid of sun.nio.cs.Surrogate" itself is not a sufficient enough 
reason to add bunch of new supplementary
support related APIs into Character and CharBuffer classes.  You 
probably need to demonstrate more use
scenarios to show/prove why these new APIs are needed, why they can not 
be easily achieved by using existing
APIs and especially you should ask yourself first if these APIs 
will/should be used/needed by "general public"
or they are just "specifically" needed by your current application/project.

For example, the isBMP(int), it might be convenient, but it can be 
easily archived by the one line code

(int)(char)codePoint == codePoint;

or more readable form

    codePoint < Character.MIN_SUPPLEMENTARY_COE_POINT;

I'm not saying we can NOT add isBMP() (I know icu4j's UCharacter class does have one), just
believe it's arguably not necessary.

Same as the pair

-- static char highSurrogate(int codePoint);
-- static char lowSurrogate(int codePoint);
-- CharBuffer.putCodePoint(int)

In "normal use case", the Character.toChars(int codePoint) is good enough cover them all.

Masayoshi is one of the lead engineers that designed most of the Unicode 
supplementary character
support APIs back in 1.5, he might give us some thoughts on this one.

Sherman

Ulf Zibis wrote:
> Hi all,
>
> I have put all important things of sun.nio.cs.Surrogate to java.* 
> packages, I guess. We likely could get rid of it.
>
> See: https://bugs.openjdk.java.net/show_bug.cgi?id=100104
>
>




More information about the core-libs-dev mailing list