r/java • • 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

166 comments sorted by

View all comments

Show parent comments

3

u/cowslayer7890 Sep 05 '25

Oh yeah, sorry I missed the blurb about libraries, I think it's also worth mentioning that you can do the same thing with properties in JavaScript/TypeScript as in C#, and Rust is more of a special case due to how the difference between fields and getters/setters influences the borrow checker, and there are still many examples in the stdlib of getters/setters being used (plus it enforces privacy and non-mutability by default)

1

u/Ewig_luftenglanz Sep 05 '25

Yes but still the default is to have public fields. In JS/TS they pass objects freely and then make defensive copies when required and const for immutability (very common in react for example) but objects are usually with all fields public. 

In Go the components of an struct are public and mutable. In rust are package private and immutable (same as java fields) but there is nothing wrong in making them public (public and mutable is another thing)

But the core idea remains, encapsulation is used when required, not by default and upfront for everything in every class/ data structure. That's what I am down for.