Move annotation to type instead of field

MSAL

Annotations that could be applied to either a field or a type are better applied to the type, because similar annotations may be more restrictive, leading to compile errors like 'scoping construct cannot be annotated with type-use annotation' when migrating later. Applies to fields, local variables, method parameters and method return types.

org.openrewrite.staticanalysis.java.MoveFieldAnnotationToType

Optional

The type of annotation to move. Defaults to org.openrewrite..*.

mod run . --recipe=org.openrewrite.staticanalysis.java.MoveFieldAnnotationToType

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