rewrite
rewrite copied to clipboard
Added arrays to AddOrUpdateAnnotationAttribute
Added the option to add, replace or remove string arrays in annotation attributes.
What's changed?
The Implementation of the Recipe AddOrUpdateAnnotationAttribute is now able to add, replace or remove a string array in a annotation attribute.
Example:
- org.openrewrite.java.AddOrUpdateAnnotationAttribute:
annotationType: org.example.Foo
attributeName: array
attributeValue: newTest
addOnly: false
Interface:
package org.example;
public @interface Foo {
String[] array() default {};
}
Before:
import org.example.Foo;
@Foo(array = {"oldTest"})
public class A {
}
After:
import org.example.Foo;
@Foo(array = {"newTest"})
public class A {
}
What's your motivation?
A work colleague was using this part of the project and discovered the missing implementation, so he handed it over to me to implement it.