spring-security icon indicating copy to clipboard operation
spring-security copied to clipboard

WebAuthenticationDetails#hashCode often returns zero

Open murrayw24 opened this issue 9 years ago • 0 comments

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

murrayw24 avatar Nov 15 '16 10:11 murrayw24