Add a @Contract nullness contract to a validation helper
ProprietaryAdds an org.jetbrains.annotations.@Contract annotation to a single-@Nullable-parameter helper method whose body provably encodes a nullness contract, so the checker can narrow at every call site without any runtime assertion. Three canonical body shapes are recognized: a boolean-returning method whose body is return arg != null && ...; (the argument's non-nullity is a required conjunct) becomes @Contract("null -> false"); a method that unconditionally throws — or delegates to requireNonNull / checkNotNull — when the argument is null becomes @Contract("null -> fail"); and an identity pass-through that returns the argument unchanged becomes @Contract("null -> null"). Only methods with exactly one parameter, a simple recognizable body, and no existing @Contract are annotated. The edit is annotation-only and behavior-preserving — runtime semantics are unchanged. Idempotent and conservative; only Java sources are modified.
io. moderne. nullability. AddNullnessContractToValidationHelperOptional
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. AddNullnessContractToValidationHelperInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.