Merge pull request #21394 from dreis2211
* pr/21394: Polish "Calculate hashCode only once in ConfigurationPropertyName" Calculate hashCode only once in ConfigurationPropertyName Closes gh-21394
This commit is contained in:
commit
46f353461b
|
@ -444,6 +444,7 @@ public final class ConfigurationPropertyName implements Comparable<Configuration
|
||||||
}
|
}
|
||||||
hashCode = 31 * hashCode + elementHashCode;
|
hashCode = 31 * hashCode + elementHashCode;
|
||||||
}
|
}
|
||||||
|
this.hashCode = hashCode;
|
||||||
}
|
}
|
||||||
return hashCode;
|
return hashCode;
|
||||||
}
|
}
|
||||||
|
|
|
@ -619,4 +619,11 @@ class ConfigurationPropertyNameTests {
|
||||||
assertThat(ConfigurationPropertyName.isValid("foo!bar")).isFalse();
|
assertThat(ConfigurationPropertyName.isValid("foo!bar")).isFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void hashCodeIsStored() {
|
||||||
|
ConfigurationPropertyName name = ConfigurationPropertyName.of("hash.code");
|
||||||
|
int hashCode = name.hashCode();
|
||||||
|
assertThat(name).hasFieldOrPropertyWithValue("hashCode", hashCode);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue