Migrate from javax annotation API to JSpecify

MSAL

Replace the javax.annotation @Nullable, @CheckForNull, @Nonnull and @ParametersAreNonnullByDefault annotations with their JSpecify equivalents, adding the JSpecify dependency where needed.

org.openrewrite.java.jspecify.MigrateFromJavaxAnnotationApi
mod run . --recipe=org.openrewrite.java.jspecify.MigrateFromJavaxAnnotationApi

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. Add Gradle or Maven dependency org.jspecify:jspecify:1.0.0
  2. Remove annotation from void method javax.annotation.Nullable
  3. Remove annotation from void method javax.annotation.CheckForNull
  4. Remove annotation from void method javax.annotation.Nonnull
  5. Move annotation to array type javax.annotation.*ull*
  6. Change type javax.annotation.Nullable to org.jspecify.annotations.Nullable
  7. Change type CheckForNull to Nullable
  8. Change type Nonnull to NonNull
  9. Change type ParametersAreNonnullByDefault to NullMarked
  10. Move annotation to type instead of field
  11. Remove duplicate annotations