-
Notifications
You must be signed in to change notification settings - Fork 21
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
Consider Lombok annotations for loggers #114
Comments
Hi @migualchico; interesting case! In part this is down to OpenRewrite not yet supporting Lombok annotations; support for that is tracked in: Because we don't yet support Lombok annotations, this conditional fails, as there's no such field found rewrite-logging-frameworks/src/main/java/org/openrewrite/java/logging/PrintStackTraceToLogError.java Lines 79 to 80 in 73eb21a
We can likely do two things to hope to resolve your immediate issue:
The second approach might be easier to tackle, starting with a draft pull request that merely adds a test to verify the desired behavior. Would you be willing to try your hand at that? |
* Add limited support for Lombok log annotations Fixes #114 * Remove JetBrains NotNull annotation * Also support `@Sf4j` in SystemErrToLogging * Remove unused field from test * Also cover SystemOutToLogging * Harden mavenProjectDependenciesUpdated() with new releases
Thanks for reporting your findings here! This should be fixed in You can try out this change through our snapshot versions, pending the next release. Please let us know how this works for you! :) |
What problem are you trying to solve?
I'm trying to use logging recipes in a project that uses Lombok to declare SLF4J loggers.
The recipes I've tried so far don't change my source code if the logger instance is created by the Lombok Slf4j annotation.
For example try to use the "Use logger instead of printStackTrace()" with the following code:
and it won't make any changes to the code.
If I don't use the Lombok annotation and just create a Logger by myself, everything works perfectly
Describe the solution you'd like
It is desirable that Lombok annotations are included in the existing recipes (not just the one in the example above)
Have you considered any alternatives or workarounds?
There is no workaround possible that I'm aware of
The text was updated successfully, but these errors were encountered: