Refactor calculateHashCode method for clarity

This will:
1. Mathematical Distribution (Collision Reduction)
2. Pipelining and CPU Caching
3. Avoiding "Method Heavy" Expressions

See gh-36325

Signed-off-by: Agil <41694337+AgilAghamirzayev@users.noreply.github.com>
This commit is contained in:
Agil
2026-03-09 17:38:15 +00:00
committed by rstoyanchev
parent cd0c26b6db
commit ce5c4f3b4b
@@ -541,11 +541,19 @@ public final class RequestMappingInfo implements RequestCondition<RequestMapping
@SuppressWarnings({"ConstantConditions", "NullAway", "removal"})
private int calculateHashCode() {
return (this.pathPatternsCondition != null ? this.pathPatternsCondition : this.patternsCondition).hashCode() * 31 +
this.methodsCondition.hashCode() +
this.paramsCondition.hashCode() + this.headersCondition.hashCode() +
this.consumesCondition.hashCode() + this.producesCondition.hashCode() +
this.versionCondition.hashCode() + this.customConditionHolder.hashCode();
Object patternBase = (this.pathPatternsCondition != null)
? this.pathPatternsCondition
: this.patternsCondition;
int h = patternBase.hashCode();
h = 31 * h + methodsCondition.hashCode();
h = 31 * h + paramsCondition.hashCode();
h = 31 * h + headersCondition.hashCode();
h = 31 * h + consumesCondition.hashCode();
h = 31 * h + producesCondition.hashCode();
h = 31 * h + customConditionHolder.hashCode();
return h;
}
@Override