Summary
In this chapter, we talked about metaprogramming: what it is, how it works, and how it can or cannot be useful concerning clean code and refactoring. In particular, we looked at two very popular libraries that involve metaprogramming, especially code auto-generation: Lombok and MapStruct.
We also warned you about the potential risks of using reflection and, in general, spoke about the pros and cons of using metaprogramming tools.
In the next chapter, we will dive into static analysis, a method of code inspection that checks for issues without executing the code, and dynamic analysis, which involves evaluating code during its execution to identify problems.