Align override nullability with the supertype

Proprietary

Aligns a method or lambda parameter whose declared nullability is inconsistent with the supertype member it overrides, a contract violation under NullAway. An override that restricts a @Nullable supertype parameter to non-null has JSpecify @Nullable added to that parameter (parameters are contravariant). An override that widens a supertype return to @Nullable is left as it is, since PropagateNullableAcrossOverrides widens the supertype in turn. Conservative: a supertype's annotations are trusted only when the supertype is itself in an annotated scope, and nothing is changed when a participating type cannot be resolved. Idempotent; Java sources only.

io.moderne.nullability.AlignOverrideNullabilityWithSupertype

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

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