This is true, but also the fact that using locks is wrong here. You only need volatile .
In fact, you donโt even need to, since you never read the value, so you can completely exclude the variable and the lock.
The point is that for a simple record, findbugs warn something, probably right, it just warns about the wrong thing.
source share