Browse Source

Use JDK hashCode() variants for primitives

See gh-8768
pull/8128/merge
dreis 9 years ago committed by Stephane Nicoll
parent
commit
f3bbbc4530
  1. 2
      spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/ConditionOutcome.java
  2. 6
      spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/FileSnapshot.java
  3. 4
      spring-boot-test-autoconfigure/src/main/java/org/springframework/boot/test/autoconfigure/filter/AnnotationCustomizableTypeExcludeFilter.java
  4. 2
      spring-boot-test/src/main/java/org/springframework/boot/test/mock/mockito/MockDefinition.java

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

@ -124,7 +124,7 @@ public class ConditionOutcome { @@ -124,7 +124,7 @@ public class ConditionOutcome {
@Override
public int hashCode() {
return ObjectUtils.hashCode(this.match) * 31
return Boolean.hashCode(this.match) * 31
+ ObjectUtils.nullSafeHashCode(this.message);
}

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

@ -70,9 +70,9 @@ class FileSnapshot { @@ -70,9 +70,9 @@ class FileSnapshot {
@Override
public int hashCode() {
int hashCode = this.file.hashCode();
hashCode = 31 * hashCode + (this.exists ? 1231 : 1237);
hashCode = 31 * hashCode + (int) (this.length ^ (this.length >>> 32));
hashCode = 31 * hashCode + (int) (this.lastModified ^ (this.lastModified >>> 32));
hashCode = 31 * hashCode + Boolean.hashCode(this.exists);
hashCode = 31 * hashCode + Long.hashCode(this.length);
hashCode = 31 * hashCode + Long.hashCode(this.lastModified);
return hashCode;
}

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

@ -121,12 +121,12 @@ public abstract class AnnotationCustomizableTypeExcludeFilter extends TypeExclud @@ -121,12 +121,12 @@ public abstract class AnnotationCustomizableTypeExcludeFilter extends TypeExclud
public int hashCode() {
final int prime = 31;
int result = 0;
result = prime * result + ObjectUtils.hashCode(hasAnnotation());
result = prime * result + Boolean.hashCode(hasAnnotation());
for (FilterType filterType : FilterType.values()) {
result = prime * result
+ ObjectUtils.nullSafeHashCode(getFilters(filterType));
}
result = prime * result + ObjectUtils.hashCode(isUseDefaultFilters());
result = prime * result + Boolean.hashCode(isUseDefaultFilters());
result = prime * result + ObjectUtils.nullSafeHashCode(getDefaultIncludes());
result = prime * result + ObjectUtils.nullSafeHashCode(getComponentIncludes());
return result;

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

@ -105,7 +105,7 @@ class MockDefinition extends Definition { @@ -105,7 +105,7 @@ class MockDefinition extends Definition {
result = MULTIPLIER * result + ObjectUtils.nullSafeHashCode(this.typeToMock);
result = MULTIPLIER * result + ObjectUtils.nullSafeHashCode(this.extraInterfaces);
result = MULTIPLIER * result + ObjectUtils.nullSafeHashCode(this.answer);
result = MULTIPLIER * result + (this.serializable ? 1231 : 1237);
result = MULTIPLIER * result + Boolean.hashCode(this.serializable);
return result;
}

Loading…
Cancel
Save