Recipe nullability best practices

MSAL

Use JSpecify nullable annotations; drop Nonnull annotations; use NullMarked on package-info.java instead.

org.openrewrite.java.recipes.RecipeNullabilityBestPractices
mod run . --recipe=org.openrewrite.java.recipes.RecipeNullabilityBestPractices

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

Recipe list

It runs these recipes, in this order.

  1. Migrate from OpenRewrite annotations to JSpecify
  2. Remove annotation @org.jetbrains.annotations.NotNull
  3. Remove annotation @javax.annotation.Nonnull
  4. Remove annotation @jakarta.annotation.Nonnull
  5. Migrate to JSpecify
  6. Annotate methods which may return null with @Nullable
  7. Move @Nullable method annotations to the return type