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

feat: use Lombok Log Annotations #644

Merged
merged 16 commits into from
Jan 5, 2025
Merged

Conversation

timo-a
Copy link
Contributor

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

What's changed?

adds recipe that replaces explicit logger fields with the lombok annotation.

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

Naming of the declarative catch-all recipe.
The recipes have nullable arguments. Where should they be documented?

Anyone you would like to review specifically?

Any additional context

More context here: https://timo-a.github.io/rewrite-recipe-starter/component-singleton/0/recipes/lombok/log/a_LogManual.html

Some annotations (like @Flogger) are missing. This is on purpose. I've done what I consider the most commonly used ones. People who need others can easily add them, based on what's already there.

The recipes allow for field names other than log, however they do not add lombok.log.fieldName=customLoggerName
to lombok.config. Not sure how difficult that would be to implement. Would be nice to have but I think the effort of doing it manually manual is reasonable.

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

@timtebeek timtebeek self-requested a review January 1, 2025 14:43
@timtebeek timtebeek added the recipe Recipe requested label Jan 5, 2025
@timtebeek timtebeek marked this pull request as ready for review January 5, 2025 16:02
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.

Thanks a lot for this work @timo-a ! I've made some changes to use Type and Method matchers when comparing current fields, pull up the majority of the logic into LogVisitor, and rename usages of any alternatively named logger fields. With that I think we're good to merge, thanks!

@timtebeek timtebeek merged commit 3ddf378 into openrewrite:main Jan 5, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
recipe Recipe requested
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants