Add @MonotonicNonNull to a lazily-initialized field
ProprietaryAnnotates a lazily-initialized field with the Checker Framework @org.checkerframework.checker.nullness.qual.MonotonicNonNull annotation, the correct contract for a field that NullAway flags as not assigned in the constructor but that is set lazily and never reset to null (so @Nullable would needlessly force readers to handle null). A field qualifies when at least one assignment to it is guarded by a f == null check, it is never assigned null except in its declaration initializer, and it is not assigned non-null at its declaration or unconditionally in a constructor. Primitive, final, static, and already-annotated fields are skipped, and only Java fields are modified.
io. moderne. nullability. AddMonotonicNonNullToLazilyInitializedFieldmod run . --recipe= io. moderne. nullability. AddMonotonicNonNullToLazilyInitializedFieldInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.