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

221

u/Turbots Jun 01 '24

Lombok. It can cause quite a few unexpected problems with generated code, like adding a toString that automatically prints out all fields in the class, even if some of those are being lazily loaded.

I don't like it because it gives junior developers the feeling they can cut corners and write much less code, without knowing what the annotations do. And most of the features that Lombok offered are now part of the Java language.

It also adds unnecessary requirements when developing like IDE support, additional settings in maven/gradle etc..

11

u/barcelleebf Jun 01 '24

It cuts down on boiler plate code. We have a project with huge numbers of pojos that need equals/ hash code, and other required features. I've even thought about writing an extract annotation to handle an extra method needed.

-6

u/Turbots Jun 01 '24

Generate them using your IDE.

The code is gonna be there in your bytecode anyway, why is everyone so concerned about getters and setters and equals being in your codebase (as long as they're being used, usually you don't need them at all).

Is it because of the arduous code coverage tools that would complain about your unused methods? Because that's fighting a symptom for a problem that should be resolve differently imo.

→ More replies (7)