src/java.base/share/classes/java/lang/String.java

Print this page
rev 11781 : 8061254: SPECjvm2008-XML performance regressions in 9-b33
Reviewed-by: TBD

@@ -1471,12 +1471,14 @@
         int h = hash;
         if (h == 0) {
             for (char v : value) {
                 h = 31 * h + v;
             }
+            if (h != 0) {
             hash = h;
         }
+        }
         return h;
     }
 
     /**
      * Returns the index within this string of the first occurrence of