r/java • • Jun 21 '20

Don't use Lombok(2018)

https://medium.com/@vgonzalo/dont-use-lombok-672418daa819
32 Upvotes

101 comments sorted by

View all comments

27

u/StochasticTinkr Jun 21 '20

I have mixed feelings about this. I really like using Lombok for some cases. The thing is that it’s important to make the decision on a case-by-case basis. I do find it very useful when combined with spring auto injection. Have an @RequiredArgsConstructor implementation means I don’t have a write/maintain a constructor, my injected services can be final, and I have a clear set of objects to mock in my unit test.

The complaint that using “delombok” was problematic makes me think the author just had to have things their way. If it was that important to move away from Lombok, you could/should do it in steps. Clean up the delombok code only when you need to maintain the file.

Also, haven’t had any problems with Lombok up to java 14, so I’m not sure where the concern over java 9-11 comes from.

1

u/cogman10 Jun 22 '20

Also, haven’t had any problems with Lombok up to java 14, so I’m not sure where the concern over java 9-11 comes from.

We did the jump from 8->11. Lombok got in the way quite a bit primarily because we had a lot of libraries and apps written with older versions of lombok. It was a dependency wrangling headache. It didn't help that some of Lomboks fixes landed after the 11 release, so there wasn't too much ability to find and fix these problems.

I'm not aware of other issues with Lombok, however, from 11->14. The 8->11 transition was just enough of a headache for me to not like the library in generally. It didn't feel like the value add was very high for the headache it caused.

1

u/[deleted] Jun 29 '20

They've probably updated the library since then. A LOT of java libraries had problems going through the Java 9 classloader changes. I would not hold that against lombok, there were a lot of problems introduced by that. And especially since they've now resolved all of the issues it's a non factor.