Posts

Showing posts from June, 2021

Good and Bad usage of Lombok

Image
Lombok  is a really nice tool that helps us to write less code and helps us to concentrate more on our actual work. It is more about how you use Lombok in your project. I see good and bad usage of Lombok. What Is Lombok Lombok is a Java library that reduces the boilerplate code in our classes. You add some annotations and Lombok generate codes for you at the compile-time. For example, if you annotate your class from the @Getter annotation then Lombok generates getter methods for all the variables in the class.  How Lombok works First, let us talk about how the compilation process works. There are three main steps in the process Parse and Enter , Annotation Processing , Analyse and Generate .  In  Parse and Ente , source files are read into a syntax tree ( AST ) and each tree is passed to Enter. All the annotation processors are called in the  Annotation Processing  step. If annotation processors generate new source or class files, the compilation process goes into the first steps and