Remove duplicate annotations

MSAL

Remove annotations that are repeated on the same element, keeping only the first occurrence. Duplicates typically arise when several distinct annotations are migrated to a single new annotation, such as when both javax.annotation.Nullable and javax.annotation.CheckForNull become org.jspecify.annotations.Nullable. @Repeatable annotations are left alone, as repeating those is meaningful.

org.openrewrite.staticanalysis.RemoveDuplicateAnnotations

Optional

The type of annotation to deduplicate, as a type pattern. Defaults to any annotation.

mod run . --recipe=org.openrewrite.staticanalysis.RemoveDuplicateAnnotations

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