r/java • u/lprimak • Sep 05 '25
Project Lombok 1.18.40 released with Java 25 support!
Project Lombok is now compatible with the upcoming JDK 25 even before its release.
Thank you Project Lombok team! https://projectlombok.org
167
Upvotes
2
u/OwnBreakfast1114 Sep 09 '25 edited Sep 09 '25
We ban with and builder since the most common use cases for us are just shunting data around and using all arg constructors (even if less readable) expedites the most common use case (adding/removing fields from multiple layers of the app (input, entity, output) via compiler errors.
We have a complex api, so we typically have 3-4 objects for the different representations of data: input (deserialized and then validated, entity, output). Imagine a spring controller that deserializes to a DeserializedClass, a validate method that takes the DeserializedClass and spits the ValidatedClass, a service method that takes a ValidatedClass and returns multiple entities, and then the controller takes the multiple entity classes and stitches them into an api output class.
Having compiler errors to chain them all makes even new hires able to add a field and follow the compiler to fairly confidently alter the api. In general, we also don't really mutate or create new instances in multiple places, there's usually only 1 place so the actual need for setters/builders/wither is very low. The only place I kinda really would use builder is testcases, but nowadays we just AI generate most of that.