Migrate from javax annotation API to JSpecify
MSALReplace the javax.annotation @Nullable, @CheckForNull, @Nonnull and @ParametersAreNonnullByDefault annotations with their JSpecify equivalents, adding the JSpecify dependency where needed.
org. openrewrite. java. jspecify. MigrateFromJavaxAnnotationApimod run . --recipe= org. openrewrite. java. jspecify. MigrateFromJavaxAnnotationApiInstall 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.
- Add Gradle or Maven dependency
org.jspecify:jspecify:1.0.0 - Remove annotation from
voidmethodjavax.annotation.Nullable - Remove annotation from
voidmethodjavax.annotation.CheckForNull - Remove annotation from
voidmethodjavax.annotation.Nonnull - Move annotation to array type
javax.annotation.*ull* - Change type
javax.annotation.Nullabletoorg.jspecify.annotations.Nullable - Change type
CheckForNulltoNullable - Change type
NonnulltoNonNull - Change type
ParametersAreNonnullByDefaulttoNullMarked - Move annotation to type instead of field
- Remove duplicate annotations