Remove a redundant @NonNull annotation under @NullMarked

Proprietary

Removes an explicit @NonNull / @Nonnull annotation that is redundant inside a @NullMarked scope, where non-null is already the default. In JSpecify-normalized code an unannotated declaration in an annotated scope is already non-null, so the annotation merely restates the default; removing it leaves the declared nullability — and therefore runtime behavior — unchanged. Conservative: it acts only on a declaration whose enclosing type is in the fix scope (@NullMarked / AnnotatedPackages), removing the annotation from either the leading (declaration) position or the TYPE_USE position; it never touches @Nullable, @CheckForNull, or @MonotonicNonNull. The annotation import is dropped when this was its last use. Annotation-only and idempotent; only Java sources are modified.

io.moderne.nullability.RemoveRedundantNonNullAnnotation

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

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