Skip to content

Commit

Permalink
use toString + hashCode() when key is empty for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
agrgr committed Jun 13, 2024
1 parent 9eefab6 commit 15ba1ca
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ public ValueWrapper putIfAbsent(Object key, Object value) {

private Key getKey(Object key) {
int userKey = (key instanceof SimpleKey && key.equals(SimpleKey.EMPTY))
// return hash code of key's class (hash code of key itself can be equal to 1) when no arguments are given
? key.getClass().hashCode()
// return hash code of key.toString() (hash code of key itself can be equal to 1) when key is empty
? key.toString().hashCode()
: key.hashCode();
return new Key(cacheConfiguration.getNamespace(), cacheConfiguration.getSet(), userKey);
}
Expand Down

0 comments on commit 15ba1ca

Please sign in to comment.