Ensure when equals() is implemented so is hashCode()
Update classes that override `equals()` to ensure that they also implement `hashCode()`. Issue: SPR-16968
This commit is contained in:
committed by
Juergen Hoeller
parent
9de3689f63
commit
634f5c2792
@@ -192,6 +192,14 @@ public abstract class MethodMatchers {
|
||||
return (targetClass != null && this.cf2.matches(targetClass));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hashCode = 17;
|
||||
hashCode = 37 * hashCode + this.cf1.hashCode();
|
||||
hashCode = 37 * hashCode + this.cf2.hashCode();
|
||||
return hashCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (this == other) {
|
||||
|
||||
Reference in New Issue
Block a user