Closed timtebeek closed 12 months ago
@rzwitserloot from an end user perspective this has been covered through a new OpenRewrite recipe. The documentation is not yet up, but is it's now possible to phase out lombok.val with their Maven or Gradle plugin.
Question then becomes what you want to do with the issue on this project. You can for instance refer to the implementation at OpenRewrite from the lombok documentation, or keep this issue open if you still plan to implement this yourselves. Either approach could open the door to eventual deprecation (with optional removal), if that's the way you want to go.
Unlikely to be picked up here; users interested in this change can execute this recipe: https://docs.openrewrite.org/recipes/java/migrate/lombok/lombokvaltofinalvar
Closing issue.
Describe the feature As discussed here, it would be nice to either have a new command
valToVar
or mode ofdelombok
to replace existing usage oflombok.val
withfinal var
in the source code. This is intended to move away fromlombok.val
specifically, leaving all other code, comments and lombok features intact.Describe the target audience Anyone using Java 10/11+, and looking to move away from
lombok.val
specifically, towardsfinal var
, while leaving all other usage of lombok features intact.Additional context
lombok.val
was added to reduce boilerplate, and up to Java 10 that was indeed true. With the arrival offinal var
there is less of a need to uselombok.val
, and it can be troublesome for other tools to work with.To keep things simple support could be limited to Java 11+; that way there's no need to replace
val
with the actual type on Java 8.At present delombok produces the code to a separate target folder; instructions can be provided to move the altered files back into the source folder to complete the phase out of
lombok.val
. Even better if replacement could be done in place, but that's optional.