String.lastIndexOf confused by unpaired trailing surrogate
Martin Buchholz
martinrb at google.com
Tue Mar 23 18:19:11 UTC 2010
Ulf,
Please do not delete methods in Surrogate.java
(because we take compatibility seriously)
but instead gently denigrate them,
as I do below (added to my patch isBMPCodePoint2)
diff --git a/src/share/classes/sun/nio/cs/Surrogate.java
b/src/share/classes/sun/nio/cs/Surrogate.java
--- a/src/share/classes/sun/nio/cs/Surrogate.java
+++ b/src/share/classes/sun/nio/cs/Surrogate.java
@@ -77,6 +77,7 @@
/**
* Tells whether or not the given UCS-4 character must be represented as a
* surrogate pair in UTF-16.
+ * Use of {@link Character#isSupplementaryCodePoint} is generally
preferred.
*/
public static boolean neededFor(int uc) {
return Character.isSupplementaryCodePoint(uc);
@@ -102,6 +103,7 @@
/**
* Converts the given surrogate pair into a 32-bit UCS-4 character.
+ * Use of {@link Character#toCodePoint} is generally preferred.
*/
public static int toUCS4(char c, char d) {
assert Character.isHighSurrogate(c) && Character.isLowSurrogate(d);
Martin
More information about the core-libs-dev
mailing list