top of page

What is Lombok? Advantages and Disadvantages of Lombok





Project Lombok is a java library that automatically plugs into your editor and build tools, spicing up your java. Never write another getter or equals method again, with one annotation your class has a fully featured builder, Automate your logging variables, and much more. For Example: If you annotate your class from @getter annotation then LomBok generates getter methods for all the variable in the class


How it Works:

There are three main steps in the process:

  1. Parse and Enter

  2. Annotation Processing

  3. Analyse and Generate.


Parse and Enter

The source files are read into Syntax tree and each three is passed to Enter


Annotation Processing:

The Annotation Processor is called Annotation Processing. If annotation processor generates new source file, the compilation process goes into the first steps and start the process again. This will repeat until there is no new source file generated by annotation processor.


Analyse and Generate:

AST is translated into class file in Analyse and Generate Step. We can modify the class which us going to generate from the source code by changing the AST.




Advantages:

1. Saves Time and Money: if your project have lots of DTOs and POJOs, then you should consider using LomBok.

2. Makes code clear : Using LomBok can make your code more clean and easily readable.

3. Opensource: It is opensource library. No need to pay for it use

4. Support Team: This us used by numerous developers. You can easily find the answer to your question from the support team.

5. It is safe for your projects.



Disadvantages:

1. Difficult to code. Good idea to use LomBok is to use it in every single java class as it might be difficult to move back to plain java later.

2. IDE plugins is needed.

3. Difficult to debug.

4. The biggest disadvantage is that generated code does not show up in Javadocs.






Sofia Sondh

The Tech Platform

0 comments

Comentários


bottom of page