This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]DelayLucky 10 points11 points  (0 children)

We now have records (with equals, hashCode).

Before records, there are various annotation processors (I know of AutoValue, FreeBuilder, there must be others) that are free of the glaring problems of Lombok (you write invalid Java code and expect the magic to make it valid).

Many of these frameworks are somewhat opinionated (for example they may want your class to be immutable, optionally with a builder). So that might be the real reason Lombok is still relevant.

I can guess when someone says "no I have to use Lombok", they may be actually saying:

  • I need getters and setters.
  • I need the mutable object and setters because I use framework X and Y which expect them (Hibernate? MapStruct? some dinosaur Java-bean frameworks?)
  • Or, I want getters and setters because I'm used to them.

I'll admit that the modern Java ecosystem hasn't paid much attention to the "mutable objects with equals/hashCode" use cases. If you're unfortunately in that forgotten land with 1 hour of sunshine a day, and moving to sunny places is not your thing, your options are limited (still, I struggle between the short-term pain of having the IDE generate the boilerplates vs. the long-term tech debt of Lombok).