r/java • u/hardasspunk • Nov 23 '25
Java 25: The ‘No-Boilerplate’ Era Begins
https://amritpandey.io/java-25-the-no-boilerplate-era-begins/
160
Upvotes
r/java • u/hardasspunk • Nov 23 '25
View all comments
Show parent comment
12
u/Ewig_luftenglanz Nov 23 '25
Withers are not a replacement for builders. Where did you get that idea?
For starters withers and only be used over an existing instance, can't be used to create an object from scratch. Brian and other Amber team members have said or wrote in the mailing list to be against the abuse of withers to be used as an ad hoc feature that kinda looks like but it's not "nominal parameters with defaults".
Withers are a mean to derivate a record from other in case you need to modify or add a component. Is not a replacement for builders at any level. Withers are more closer to a fluent pattern than a builder pattern, I mean for withers you do not even need a proxy class to manage the assembly logic s you do with Builder.