Skip to content

AddOrUpdateAnnotationAttribute: Add better support for enums #5709

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

Merged
merged 17 commits into from
Aug 5, 2025

Conversation

jevanlingen
Copy link
Contributor

@jevanlingen jevanlingen commented Jul 3, 2025

What's changed?

  • Annotations with methods with enums are supported as well.
  • Partial, but better support for constant
  • FullyQualifiedClass attribute values are imported

What's your motivation?

Make this recipe usable for all possible cases.

Anything in particular you'd like reviewers to focus on?

Next to the better enum support, more refactoring has been done. The biggest change consists of the introduction of separate functions to update the annotation arguments.

Any additional context

Also contains fixes from

as that PR was reverted, because an enabled addOnly option did not make changes when something like @Foo(name = "old") to @Foo(value = "new", name = "old") was intended, which caused problems downstream. That's fixed in this PR as well (see cbf2069).

Checklist

  • I've added unit tests to cover both positive and negative cases
  • I've read and applied the recipe conventions and best practices
  • I've used the IntelliJ IDEA auto-formatter on affected files

@jevanlingen jevanlingen self-assigned this Jul 3, 2025
@jevanlingen jevanlingen added the recipe Requested Recipe label Jul 3, 2025
@github-project-automation github-project-automation bot moved this to In Progress in OpenRewrite Jul 3, 2025
@timtebeek timtebeek self-requested a review July 3, 2025 15:31
@jevanlingen jevanlingen force-pushed the AddOrUpdateAnnotationAttribute-improvement branch 5 times, most recently from 6ee58c7 to 203d1b0 Compare July 4, 2025 06:54
@github-project-automation github-project-automation bot moved this from In Progress to Ready to Review in OpenRewrite Jul 4, 2025
@jevanlingen jevanlingen requested a review from jkschneider July 7, 2025 06:29
@jevanlingen jevanlingen force-pushed the AddOrUpdateAnnotationAttribute-improvement branch from 2dc4c2a to 0b5df44 Compare July 29, 2025 07:49
@openrewrite openrewrite deleted a comment from github-actions bot Aug 1, 2025
Copy link
Member

@timtebeek timtebeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Appreciate the additional tests; the amount of changes in the recipe is a little larger than I would have liked, but went through it in detail and it seems you've been able to clear out some subtle issues by extracting out dedicated methods and working out how the options should combine. Thanks for that; let's wait for a final review before we merge.

@sambsnyd sambsnyd merged commit e5caa04 into main Aug 5, 2025
2 checks passed
@sambsnyd sambsnyd deleted the AddOrUpdateAnnotationAttribute-improvement branch August 5, 2025 00:36
@github-project-automation github-project-automation bot moved this from Ready to Review to Done in OpenRewrite Aug 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
recipe Requested Recipe
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants