Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@
<path>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_core</artifactId>
<version>2.50.0</version>
<version>2.51.0</version>
</path>
<path>
<groupId>com.uber.nullaway</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,6 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return Objects.hash(name);
return 31 + Objects.hashCode(name);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,13 @@ void testEquals4() {

assertThat(unit1).isEqualTo(unit2);
}

@Test
void testEqualUnitsHaveEqualHashCodes() {
Unit unit1 = new Unit(" bytes ");
Unit unit2 = new Unit("bytes");

assertThat(unit1).isEqualTo(unit2);
assertThat(unit1.hashCode()).isEqualTo(unit2.hashCode());
}
}
Loading