Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added arrays to AddOrUpdateAnnotationAttribute #4446

Merged

Conversation

marcel-gepardec
Copy link
Contributor

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.

@timtebeek timtebeek self-requested a review August 27, 2024 14:09
@timtebeek timtebeek added the enhancement New feature or request label Aug 27, 2024
@sambsnyd sambsnyd merged commit 76e5692 into openrewrite:main Oct 11, 2024
2 checks passed
@sambsnyd
Copy link
Member

Thanks @marcel-gepardec !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants