Relax Optional.of to Optional.ofNullable on nullable values
ProprietaryRewrites Optional.of(x) to Optional.ofNullable(x) where the argument x is provably @Nullable at the call site. Optional.of(null) throws NullPointerException, while Optional.ofNullable(null) yields Optional.empty(), so the two factories diverge on the null path: this rewrite changes observable runtime behavior (an NPE becomes an empty optional) and therefore marks every call it changes for human review. The call is matched on java.util.Optional of(..); the argument's nullness is resolved from the nullness oracle and the path-sensitive flow engine (no name-based heuristics), so a value already null-checked on the path is not flagged. A non-null literal argument, or one already protected by a non-null assertion (requireNonNull / castToNonNull / …), is left untouched, keeping the recipe idempotent. Gated on the call site being in an annotated scope; only Java sources are modified.
io. moderne. nullability. RelaxOptionalOfToOfNullableOptional
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. RelaxOptionalOfToOfNullableInstall it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.