Summary

Ideally, the hashCode method defined by a class should return distinct integers for distinct objects. Not doing so impacts performance when the objects are stored in a HashMap

Actual Behavior

The algorithm in WebAuthenticationDetails#hashCode has a 26% chance of returning zero

Expected Behavior

A much broader range of hash codes are returned for distinct objects

Configuration

N/A

Version

4.0.9 and latest

Sample

https://github.com/spring-projects/spring-security/blob/master/web/src/main/java/org/springframework/security/web/authentication/WebAuthenticationDetails.java