Recipe nullability best practices
MSALUse JSpecify nullable annotations; drop Nonnull annotations; use NullMarked on package-info.java instead.
org. openrewrite. java. recipes. RecipeNullabilityBestPracticesmod run . --recipe= org. openrewrite. java. recipes. RecipeNullabilityBestPracticesInstall 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.
- Migrate from OpenRewrite annotations to JSpecify
- Remove annotation
@org.jetbrains.annotations.NotNull - Remove annotation
@javax.annotation.Nonnull - Remove annotation
@jakarta.annotation.Nonnull - Migrate to JSpecify
- Annotate methods which may return
nullwith@Nullable - Move
@Nullablemethod annotations to the return type