Remove a provably-dead if (x == null) guard

Proprietary

Removes an if (x == null) { ... } guard whose then-branch the flow engine proves unreachable because x is already non-null at that point (e.g. after an earlier assertion, guard, or assignment). Such a guard is dead code: the x == null test can never be true, so its then-branch never executes and deleting it — while keeping any else body, the only live path — preserves behavior. To match the aggressiveness Airbnb endorses and no further, the removal fires only when the path-sensitive flow analysis proves x non-null at the guard (an earlier assertion, null check, instanceof, or assignment from new, a literal, or a library method modelled never to return null), and never on a parameter of a public method (the service-edge / untrusted-input validation point NullAway guidance explicitly excludes). An unannotated parameter or call result is not proof. The condition must be a bare x == null / null == x on a simple local or parameter; a compound condition, a field, or anything not flow-proven is left untouched. Behavior-preserving (it removes only unreachable code), idempotent, and conservative; only Java sources are modified.

io.moderne.nullability.RemoveProvablyDeadNullGuard

Optional

Comma-separated package prefixes to limit the fix to (matching NullAway's AnnotatedPackages option). When unset, the recipe fixes all packages.

mod run . --recipe=io.moderne.nullability.RemoveProvablyDeadNullGuard

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.