Skip to content

Commit ebf6be8

Browse files
Fix hashcode
1 parent 3fcb13a commit ebf6be8

File tree

1 file changed

+10
-3
lines changed
  • spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types

1 file changed

+10
-3
lines changed

spring-data-eclipse-store/src/test/java/software/xdev/spring/data/eclipse/store/integration/isolated/tests/special/types/LazyDaoObject.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,19 @@ public LazyDaoObject(final Integer id, final Lazy<String> value)
2727
super(id, value);
2828
}
2929

30-
@SuppressWarnings("PMD.UselessOverridingMethod")
3130
@Override
3231
public int hashCode()
3332
{
34-
// TODO: Why is hashCode different than equals?
35-
return super.hashCode();
33+
int result = 17;
34+
if(this.getId() != null)
35+
{
36+
result = 31 * result + this.getId().hashCode();
37+
}
38+
if(this.getValue() != null)
39+
{
40+
result = 31 * result + this.getValue().hashCode();
41+
}
42+
return result;
3643
}
3744

3845
@Override

0 commit comments

Comments
 (0)