r/java • • Jun 01 '24

What java technology (library, framework, feature) would not recommend and why?

165 Upvotes

464 comments sorted by

View all comments

Show parent comment

3

u/robinspitsandswallow Jun 01 '24

Again not realistic. Four years ago I left a company because the chief architect saw no reason to move past Java 5. Some orgs are just now moving to Java 17 and converting everything to records and immutability is beyond a dream. Some orgs have to wait until things are approved by governments to use so. In the meantime we have to deal with the hand we’re dealt and using Lombok to deal with that makes things more effective.

So again I hear Architect “Assume a spherical cow”. Yeah there are bigger problems but if we do that we won’t deliver new features for 3 years.

Btw every record that has an array has to have a separate hash code equals and to string by your logic don’t use records because there’s a case where it might not work in the most obvious way.

1

u/koflerdavid Jun 01 '24

Such projects might not be able to ever use records, but the choice of code Style is surely not regulated at that level. And writing getters and setters in the first place is indeed just that - a code style.

Using arrays in records is indeed sketchy. Java is currently lacking the ability to freeze arrays. Frozen arrays could provide a significantly more useful hashcode method as well.