6921374: java.lang.String::hashCode() should check for count == 0 to avoid repeated stores hash = 0

Reviewed-by: darcy, ohair
This commit is contained in:
Alan Bateman 2010-02-27 19:29:15 +00:00
parent ab0eb81f5b
commit 16b8431cf3

View File

@ -1492,7 +1492,7 @@ public final class String
*/
public int hashCode() {
int h = hash;
if (h == 0) {
if (h == 0 && count > 0) {
int off = offset;
char val[] = value;
int len = count;