Add @MonotonicNonNull to an uninitialized field

Proprietary

Adds the Checker Framework @MonotonicNonNull to a non-primitive, non-final reference field inside a @NullMarked scope that has no nullability annotation, no initializer, no dependency-injection annotation, and is not definitely assigned by the end of construction (or is read before assignment) — the condition for NullAway's "@NonNull field not initialized" error. A constructor Lombok generates counts like a written one, and a @Builder class's no-argument constructor is skipped, as NullAway does. A field that is also assigned a literal null is genuinely nullable and gets JSpecify @Nullable instead. Java sources only; idempotent; only annotations are added.

io.moderne.nullability.AddMonotonicNonNullToUninitializedField

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.AddMonotonicNonNullToUninitializedField

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