Merge pull request #21394 from dreis2211

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

Closes gh-21394
pull/21440/head
Stephane Nicoll 5 years ago
commit 46f353461b

@ -444,6 +444,7 @@ public final class ConfigurationPropertyName implements Comparable<Configuration
}
hashCode = 31 * hashCode + elementHashCode;
}
this.hashCode = hashCode;
}
return hashCode;
}

@ -619,4 +619,11 @@ class ConfigurationPropertyNameTests {
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…
Cancel
Save