You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
java/unsafe-double-checked-locking: missed when the field is re-read through a call that returns it #22968
The query reports double-checked locking on the non-volatile field x in DclSeed.m(): the field is read into a local z, checked against null outside and again inside the synchronized block, and initialised there. DclVariant.m() is the same except the read inside the synchronized block is java.util.Collections.singletonList(x).get(0), which just returns the field's value. Nothing is reported for DclVariant.
Probably getAFieldRead in DoubleCheckedLocking.qll: a local counts as a field read when its assignment source is a field access or another such local, so a value coming back through a call isn't followed, and the inner z == null is no longer a null check of x. SpotBugs' DC_DOUBLECHECK missed the same pair (spotbugs/spotbugs#4212).
Activity