提交 fe7814be 编写于 作者: A alanb

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

Reviewed-by: darcy, ohair
上级 c9b080fb
...@@ -1492,7 +1492,7 @@ public final class String ...@@ -1492,7 +1492,7 @@ public final class String
*/ */
public int hashCode() { public int hashCode() {
int h = hash; int h = hash;
if (h == 0) { if (h == 0 && count > 0) {
int off = offset; int off = offset;
char val[] = value; char val[] = value;
int len = count; int len = count;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册