-
Notifications
You must be signed in to change notification settings - Fork 82
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
Replace lombok.val with final var on projects using Java 11 or higher #124
Conversation
Wasn't entirely sure whether this recipe would fit in best here or in openrewrite/rewrite. My guess was here as it's most applicable for users upgrading between Java versions. |
src/test/kotlin/org/openrewrite/java/migrate/lombok/LombokValToFinalVarTest.kt
Show resolved
Hide resolved
Thanks Tim! The recipe should also account for the case where List<String> lst = new ArrayList<>();
for (val s : lst) {} If you would like, I've got your PR loaded up and am happy to help with these changes :) |
src/main/java/org/openrewrite/java/migrate/lombok/LombokValToFinalVar.java
Show resolved
Hide resolved
Yes please! Just arrived in Stavanger, so won't get to it myself otherwise for another week. Feel free to change it however you feel is best! |
Well, It turns out the changes were not that simple after all... I discovered a |
Hi Tim, I've managed to get this merged in and will test it on the SaaS if everything looks good I will add a reference to the appropriate |
Thanks for the fixes & merge! The bug in JavaTemplateBlockStatementGenerator would have surely tripped me up, so I'm glad you were able to dive into this one. Curious to hear what effects you see on SaaS! :) |
Figured this would be a fun one, and learning exercise. It replaces
lombok.val
withfinal var
, as there's not a lot of value in retaininglombok.val
nowadays. As a bonus it makes projects more compatible with OpenRewrite, at least until there's integrated support.Only thing that I'm not yet sure how to resolve is the tests containing infix whitespace & comment. Some guidance there would be appreciated once again. My attempts at using
maybeAutoFormat
failed up to now.Fixes projectlombok/lombok#3207
Fixes openrewrite/rewrite#1297
TODO