A constructor calls `bus.subscribe(this)` as its first line, reasoning "the object is live as soon as it exists, so registering it immediately is fine." A field assigned on the next line is occasionally seen as `null` by the listener callback. What's wrong with the reasoning?
The object is not live "as soon as it exists" — it's live, and reachable from another thread, the moment a reference to it escapes, and bus.subscribe(this) hands out exactly such a reference while the constructor is still running. If bus can call back into the object (on another thread, or even reentrantly) before the constructor's later lines run, that callback sees the object exactly as far along as construction has gotten — which, on the first line, means every field the constructor hasn't assigned yet is still at its zeroed default. The fix is to finish constructing the object fully, then register it — typically via a static factory method that does both steps in sequence on a fully-built object, so nothing outside ever sees it half-built.