Fix SimpleKey equality with array argument
Prior to this commit, an array argument was not handled properly in SimpleKey#equals and SimpleKey#hashCode. As a result, two method invocations with the same array argument lead to two different keys and therefore two different entries in the cache. This commit uses deepEquals and deepHashCode to properly handle methods that have arguments that are array types. Issue: SPR-11505
This commit is contained in:
committed by
Stephane Nicoll
parent
a60b34fd9e
commit
6d8f3a0a20
@@ -50,12 +50,13 @@ public final class SimpleKey implements Serializable {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return (this == obj || (obj instanceof SimpleKey && Arrays.equals(this.params, ((SimpleKey) obj).params)));
|
||||
return (this == obj || (obj instanceof SimpleKey
|
||||
&& Arrays.deepEquals(this.params, ((SimpleKey) obj).params)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Arrays.hashCode(this.params);
|
||||
return Arrays.deepHashCode(this.params);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user