The Lombok project is a Java library that aims at “spicing up your java.” Started back in 2009, it consists mostly of annotations that can be used on Java classes to generate helpful constructs like getters and setters. It aims at freeing you from writing quite a number of the ceremonial boilerplate code that you sometimes need to write as part of your everyday use of Java.
Over the past few years however, the evolution of the Java Language changed. With much more frequent, predictable releases and adoption of a good number of “quality of life” features, the Java of today is not necessarily the Java that was whenLombokwas conceived and birthed. This new context has given rise to the very frequent question of what the use of Lombok is in modern Java.
That is a very valid question. But as with almost all things programming, the answer is always “it depends.” The first point is that the use of Lombok is optional. You can use Java as is without Lombok. But then also this depends on what project you are working on. Given the history of Java project upgrades, there are still a significant number of projects on older versions of Java (< 8). Within such a context, Lombok looks appealing because it is exactly those versions of Java that necessitated the existence of Lombok. Even for projects using newer versions of Java, not every project can take advantage of newer constructs like Records.
So as with all cases, the use of Lombok, or any other third party library for that matter, is always an it depends situation. The real purpose for this blog post however, is the way in which some people express their opinions on the use of the Lombok library in particular. I think it’s OK to be of the opinion that Lombok is not fully needed for modern Java. What I find a little weird is some form of condescension that sometimes accompanies such opinions.
Whether Lombok, or any other library for that matter is useful or not is a matter of personal opinion and project specific. However, I think as developers, it’s important to put things in proper context by not forgetting Lombok was created to ease pain points in previous iterations of the Java Language, at a time when the language evolved quite slowly. So questioning the raison d'etre of the library based on current iterations of Java is not telling the full story.
We should also not forget to give credit to the many man-hours that other people invest in creating such libraries that make the collective lives of us developers better. You may think Lombok has outlived its usefulness (to you and in your opinion), but that doesn’t mean the library is of no use to other people. I believe we can share our opinions on Lombok without condescension in deference to the developers of those libraries and the many other people that find great value from them. So whether to Lombok, or DeLombok, is “it depends.”