Skip to main content

Command Palette

Search for a command to run...

Still Using Lombok in 2025?

Published
2 min read
Still Using Lombok in 2025?

Introduction

The main problems with using Lombok in 2025 are the increased debugging complexity, IDE and build tool integration friction, hindrance to adopting modern Java features like records, potential for dependency bloat, and the loss of control over generated code which can lead to bugs. While it simplifies boilerplate, developers are increasingly moving to Java's native features, such as records and virtual threads, which offer better control, performance, and compatibility in modern Java development.

Debugging and Invisibility

  • Hidden code:

    Lombok generates code at compile time, meaning the methods and logic developers see in their IDEs are not present in the actual source code.

  • Debugging challenges:

    This "hidden magic" makes it difficult to trace the source of errors, understand why certain methods behave unexpectedly, or find the origin of generated code like toString() or equals().

Tooling and Ecosystem Issues

  • IDE and build tool conflicts:

    Not all tools or plugins fully support Lombok's compile-time code generation, leading to inconsistencies or failures in recognition of generated code.

  • CI/CD and static analysis issues:

    Code analyzers and continuous integration pipelines can generate false positives or fail builds when encountering Lombok's generated code.

Modern Java Features

  • Obscuring native alternatives:

    Relying on Lombok can prevent developers from learning and adopting newer Java language features designed to solve the same problems.

  • Records and immutability:

    Java's records, introduced in Java 16, provide a native and often superior way to create immutable data classes, serving as a modern alternative to Lombok's approach.

  • Virtual threads:

    The complexity introduced by Lombok's generated code can interfere with the explicit control required for high-performance features like virtual threads.

Code Quality and Control

  • Loss of intention:

    Lombok's automatic generation of methods can hide developers' intent, eliminating the opportunity to write intentional, tailored code and potentially leading to poor design decisions.

  • Encapsulation and domain logic issues:

    With @Data, Lombok can include all fields in generated methods like equals() and hashCode(), potentially exposing internal details or breaking domain logic and encapsulation.

Migration and Alternatives

  • Lombok's delombok utility:

    For projects that decide to move away from Lombok, the tool offers a way to generate the actual source code from the annotated classes, helping to gradually remove Lombok from a codebase.

  • Native Java features:

    Modern Java provides built-in solutions for many boilerplate issues, such as records for data classes, which offer better performance, maintainability, and integration with the overall ecosystem.

More from this blog

Cloud Tuned

625 posts

Your starting point for anything cloud: AWS, Azure, GCP, Serverless, Architecture, Hybrid Cloud, Systems Design and other Information Technology topics.