Commit 46f35346 authored by Stephane Nicoll's avatar Stephane Nicoll

Merge pull request #21394 from dreis2211

* pr/21394:
  Polish "Calculate hashCode only once in ConfigurationPropertyName"
  Calculate hashCode only once in ConfigurationPropertyName

Closes gh-21394
parents df25603b dd053074
...@@ -444,6 +444,7 @@ public final class ConfigurationPropertyName implements Comparable<Configuration ...@@ -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 { ...@@ -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);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment