Skip to content

Apache Lucene open-source search software

LUCENE-2643: StringHelper#stringDifference is wrong about supplementary chars

Simon Willnauer7fbdede15af4
diff --git a/lucene/src/java/org/apache/lucene/util/StringHelper.java b/lucene/src/java/org/apache/lucene/util/StringHelper.java
index bb33f5046ae..498f53e31c1 100644
--- a/lucene/src/java/org/apache/lucene/util/StringHelper.java
+++ b/lucene/src/java/org/apache/lucene/util/StringHelper.java
@@ -59,7 +59,10 @@ public abstract class StringHelper {
* @param s1 The first string to compare
* @param s2 The second string to compare
* @return The first position where the two strings differ.
+ *
+ * @deprecated This method cannot handle supplementary characters.
*/
+ @Deprecated
public static final int stringDifference(String s1, String s2) {
int len1 = s1.length();
int len2 = s2.length();