Move annotation to array type
Recipe ID
org.openrewrite.java.migrate.jspecify.MoveAnnotationToArrayTypeArtifact
org.openrewrite.recipe:rewrite-migrate-javaWhen an annotation like @Nullable is applied to an array type in declaration position, this recipe moves it to the array brackets. For example, @Nullable byte[] becomes byte @Nullable[]. Best used before ChangeType in a migration pipeline, targeting the pre-migration annotation type.
Usage
You’ll need the Moderne CLI configured before running the command below.
mod run . --recipe org.openrewrite.java.migrate.jspecify.MoveAnnotationToArrayType --recipe-option "annotationType=javax.annotation.*ull*"If the recipe isn’t available locally, install it with:
mod config recipes jar install org.openrewrite.recipe:rewrite-migrate-java:3.41.0Options
| Name | Type | Description |
|---|---|---|
annotationTyperequired | String | The type of annotation to move to the array type. Should target the pre-migration annotation type to avoid changing the semantics of pre-existing type-use annotations on object arrays. e.g. javax.annotation.*ull* |
Data tables
Structured output this recipe can produce.
- Source files that had resultsSource files that were modified by the recipe run.
org.openrewrite.table.SourcesFileResults - Source files that had search resultsSearch results that were found during the recipe run.
org.openrewrite.table.SearchResults - Source files that errored on a recipeThe details of all errors produced by a recipe run.
org.openrewrite.table.SourcesFileErrors - Recipe performanceStatistics used in analyzing the performance of recipes.
org.openrewrite.table.RecipeRunStats