Objects with multi-threaded access should not lazily populate a hash field [SPR-11428] #16054
MethodParameter, RequestMappingInfo and SimpMessageMappingInfo currently cache a lazily calculated hash value in a regular int field. This should be avoided since instances of those classes can be used as keys in caches with multi-threaded access, exposing an incomplete visibility risk for non-volatile fields.
Instead of going with volatile or synchronized, let's rather not cache those hash values to begin with but rather design simple, cheap enough hashCode() implementations that always calculate on the fly.
Affects: 3.2.7, 4.0.1
Backported to: 3.2.8
The text was updated successfully, but these errors were encountered: