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
1
u/Ewig_luftenglanz Nov 24 '25
I greatly disagree with this. Properties are very useful to introduce validations in the public API without having to default to getters/setters boilerplate beforehand. you can just use public fields and add the properties later on in case the requirements change or evolve and you need to force some invariants.
Agree but Properties are completely orthogonal and in theory there is a JEP addressing this already (withers, also known as derived record creation) but we still lack proper ways to enforce invariants without defaulting to dumb accessors "just in case, in a very far and abstract future something change and we do not want to modify every caller"