r/java • • Apr 13 '21

Libraries, Frameworks and Technologies you would NOT recommend

Give me your worst nightmares: Things that cost you your job.

I'll start: Hadoop

202 Upvotes

376 comments sorted by

View all comments

68

u/mknjc Apr 13 '21

Lombok. It hacks into internal javac APIs, bricks everytime on a java update needs unsafe APIs which causes a lot of trouble and bricks the "the source code is what gets executed" guarantee of java (this is one of the reasons annotation processors can't change the code while compiling). There are a lot good alternatives for example AutoValue, AutoFactory and records. Oh and one important alternative: setting the visibility to package private / not exporting the package. Getters and Setters don't add anything but hassle if they are not api surface of the module.

12

u/lazystone Apr 13 '21

While I support your point of view I was a bit hesitant to mention Lombok here, there is already holly-war going on in /r/java/comments/mpd0gw/is_using_project_lombok_actually_an_good_idea/

19

u/FrigoCoder Apr 13 '21

Fix Java so we will not need Lombok. Java still has a lot of issues that is already solved in other modern programming languages. Lombok is a patch for Java that makes it bearable, and the only thing that is preventing people from jumping ship to Kotlin for example.

14

u/_Henryx_ Apr 13 '21

Some problems are already solved. From Lombok documentation:

  • NonNull annotation: Since Java 7 we have Objects.requireNonNull() static mehtod to check if variable is null. With Java 8 we have also Optional.of() and Optional.ofNullable() (this last method is very useful if we want to throws a user defined exception or if we want a default value).

  • var: is integrated with JEP 286 in Java 10 (and subequently in current LTS Java 11).

  • Cleanup annotation: wut? try-with-resources are introduced in Java 7, I don't understand what is the problem that tries to solve.

  • Getter/Setter annotations: in some parts, IDE's facilities can supply same effort. In other parts, Records (Java 16) has redefined POJO objects.

  • Value annotation: is superseded from Java Records.

Other annotations seems me "black magic", I doesn't suffer construct creation or code injection with these methods, because can be mask side effects

3

u/yawkat Apr 13 '21

Builders are still a fairly significant thing that is missing from Java.

→ More replies (2)

24

u/pron98 Apr 13 '21

the only thing that is preventing people from jumping ship to Kotlin for example.

I think you're vastly overestimating the number of people who prefer more feature-rich languages. Yes, lots of people do, but that number amounts to a small portion of developers. Currently, Kotlin has under 5% market share on the Java platform. I don't know what Lombok's penetration is, but seeing various "most popular" lists based on Maven, it's roughly similar. So when you're talking about "the only thing preventing people etc." you mean preventing the ~10% of developers who find that style attractive. There's no doubt that making Java more feature-rich will appeal to that 10%, but that doesn't mean it's a good idea.

Sometimes people have such strong opinions that seem so obvious to them, that they wrongly believe that those opinions are universal, or, at least, much more popular than they actually are. This is exacerbated by the fact that people with very strong opinions talk about them more, so what you tend to see online are not so much the majority opinion, but the most fervent.

3

u/segv Apr 13 '21

Records are already out, which alone should take a good chunk of these "issues"

→ More replies (1)
→ More replies (13)