Skip to content

Commit 70f5728

Browse files
committed
Merge pull request #8768 from dreis2211:hashcode-cleanup-new
* pr/8768: Polish "Use JDK hashCode() variants for primitives" Use JDK hashCode() variants for primitives
2 parents aa40517 + 036157a commit 70f5728

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionOutcome.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2016 the original author or authors.
2+
* Copyright 2012-2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -124,7 +124,7 @@ public ConditionMessage getConditionMessage() {
124124

125125
@Override
126126
public int hashCode() {
127-
return ObjectUtils.hashCode(this.match) * 31
127+
return Boolean.hashCode(this.match) * 31
128128
+ ObjectUtils.nullSafeHashCode(this.message);
129129
}
130130

spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/FileSnapshot.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ public boolean equals(Object obj) {
7070
@Override
7171
public int hashCode() {
7272
int hashCode = this.file.hashCode();
73-
hashCode = 31 * hashCode + (this.exists ? 1231 : 1237);
74-
hashCode = 31 * hashCode + (int) (this.length ^ (this.length >>> 32));
75-
hashCode = 31 * hashCode + (int) (this.lastModified ^ (this.lastModified >>> 32));
73+
hashCode = 31 * hashCode + Boolean.hashCode(this.exists);
74+
hashCode = 31 * hashCode + Long.hashCode(this.length);
75+
hashCode = 31 * hashCode + Long.hashCode(this.lastModified);
7676
return hashCode;
7777
}
7878

spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/filter/AnnotationCustomizableTypeExcludeFilter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,12 @@ protected enum FilterType {
121121
public int hashCode() {
122122
final int prime = 31;
123123
int result = 0;
124-
result = prime * result + ObjectUtils.hashCode(hasAnnotation());
124+
result = prime * result + Boolean.hashCode(hasAnnotation());
125125
for (FilterType filterType : FilterType.values()) {
126126
result = prime * result
127127
+ ObjectUtils.nullSafeHashCode(getFilters(filterType));
128128
}
129-
result = prime * result + ObjectUtils.hashCode(isUseDefaultFilters());
129+
result = prime * result + Boolean.hashCode(isUseDefaultFilters());
130130
result = prime * result + ObjectUtils.nullSafeHashCode(getDefaultIncludes());
131131
result = prime * result + ObjectUtils.nullSafeHashCode(getComponentIncludes());
132132
return result;

spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockDefinition.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public int hashCode() {
105105
result = MULTIPLIER * result + ObjectUtils.nullSafeHashCode(this.typeToMock);
106106
result = MULTIPLIER * result + ObjectUtils.nullSafeHashCode(this.extraInterfaces);
107107
result = MULTIPLIER * result + ObjectUtils.nullSafeHashCode(this.answer);
108-
result = MULTIPLIER * result + (this.serializable ? 1231 : 1237);
108+
result = MULTIPLIER * result + Boolean.hashCode(this.serializable);
109109
return result;
110110
}
111111

0 commit comments

Comments
 (0)