Skip to content

feat: normalize effective getter methods #631

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 28 commits into from
Apr 21, 2025

Conversation

timo-a
Copy link
Contributor

@timo-a timo-a commented Dec 15, 2024

What's changed?

Adds recipe that renames "effective getter methods" to the way lombok would name them.

What's your motivation?

When a team starts without lombok, their getter and setter methods will over time stop adhering to the way lombok names them. Maybe the team never followed the lombok naming, maybe fields got renamed but not their getter methods. Maybe previously more complex methods morph into just being just getters but keep their old name...
This recipe will normalize those methods names, so the converter can find them.
This is a separate recipe on purpose. Reasons:

  • due to the edge cases listed in the recipe, it makes sense to split functionality to keep things simple.
  • maybe some recipes follow a different naming convention on purpose. This recipe will make it easy to spot these cases which might be overlooked in the many changes of one big fuzzy recipe
  • if a user only wants to convert lombok naming compliant getters and not rename any recipes, separate recipes make that possible

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

Please evaluate the edge cases. I've estimated that the effort needed to cover them is not worth it, but maybe you can see a way.
Also, I overloaded a method in LombokUtils with the original version. Maybe the methods can be merged?

Anyone you would like to review specifically?

Have you considered any alternatives or workarounds?

Any additional context

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

@timo-a timo-a changed the title feat• normalize effective getter methods feat: normalize effective getter methods Dec 15, 2024
@timo-a timo-a marked this pull request as ready for review December 21, 2024 22:05
@timtebeek timtebeek self-requested a review December 22, 2024 10:50
@timo-a timo-a force-pushed the lombok/normalize-getter branch from a7f556d to bf8d66e Compare January 1, 2025 19:22
@timtebeek timtebeek added the recipe Recipe requested label Jan 1, 2025
@timo-a timo-a force-pushed the lombok/normalize-getter branch from 65097c4 to 9442836 Compare February 16, 2025 15:00
@timo-a timo-a force-pushed the lombok/normalize-getter branch from 9442836 to 5605d68 Compare February 16, 2025 16:21
@timo-a
Copy link
Contributor Author

timo-a commented Mar 12, 2025

Hi @timtebeek, could you please take another look at this? I've applied all changes I've seen you do on the other PRs.

@timtebeek
Copy link
Contributor

Thanks for making those adjustments! That's indeed been holding back a review because of the time investment needed to adjust the PRs. We'll have another look!

github-actions[bot]

This comment was marked as off-topic.

Copy link
Contributor

@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.

This one is looking good @timo-a , thanks a lot for your patience throughout. The only thing I'm wondering is whether NormalizeGetter is descriptive enough for folks, or if we should perhaps use something like AdoptLombokGetterMethodNames, as could be clearer in the intent.

@timo-a
Copy link
Contributor Author

timo-a commented Apr 21, 2025

Yeah, I guess normalize is a bit vague. I've implemented your suggestion.

@timtebeek
Copy link
Contributor

Thanks a lot! We'll merge as soon as the tests pass, and then this should go out with the release ~Wednesday

@timtebeek timtebeek merged commit ccd18d3 into openrewrite:main Apr 21, 2025
2 checks passed
@github-project-automation github-project-automation bot moved this from Ready to Review to Done in OpenRewrite Apr 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lombok recipe Recipe requested
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants