<i18n dev> 8015880: GenerateBreakIteratorData build warning

Alan Bateman Alan.Bateman at oracle.com
Tue Jun 4 05:49:11 PDT 2013

The new build emits a lot of warnings, the warnings when building the 
build tools are the most scary. One warning that is starting to stand 
out (as other issues are addressed) is the GenerateBreakIteratorData 
tool. In the case the issue is that it overrides equals but not hashCode.

This is easily fixed by adding a hashCode method but if I read the code 
correctly, the equals method doesn't match its javadoc. The javadoc 
claims that it returns true if "that" has the exact same characters but 
that isn't so. I would like to fix this tool with the attached patch but 
it requires careful review because the broken equals method is used. 
I've run the jdk tests with this fix and don't see any issues but I 
don't know how well that BreakIterator is exercised.


diff -r 780fbbd50ce4 
Tue Jun 04 11:52:29 2013 +0100
Tue Jun 04 13:08:24 2013 +0100
@@ -39,6 +39,7 @@

  package build.tools.generatebreakiteratordata;

+import java.util.Arrays;
  import java.util.Hashtable;

@@ -701,7 +702,14 @@
       * the exact same characters as this one
      public boolean equals(Object that) {
-        return (that instanceof CharSet) && 
+        return (that instanceof CharSet) && Arrays.equals(chars, 
+    }
+    /**
+     * Returns the hash code for this set of characters
+     */
+    public int hashCode() {
+       return Arrays.hashCode(chars);


More information about the i18n-dev mailing list