mirror of
https://github.com/openjdk/jdk.git
synced 2026-04-09 22:48:41 +00:00
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:
parent
ab0eb81f5b
commit
16b8431cf3
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user