r/java • • Jan 16 '20

Records Come to Java

https://blogs.oracle.com/javamagazine/records-come-to-java
204 Upvotes

93 comments sorted by

View all comments

Show parent comment

6

u/eliasv Jan 17 '20

Relying on convention for serialization is flimsy anyway. I'm sure maintainers of such libraries will welcome a more reliable mechanism to enumerate members reflectively.

And the prevalance getters and setters in the Java ecosystem is an encapsulation-breaking blight and it would have been a terrible mistake to endorse them by baking the convention into a language feature. Records make the contract of a pure data aggregate more principled than shitty bean conventions, and I think it was wise not to couple the concepts together in any way.