question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Let's reconsider lombok

See original GitHub issue

I saw the old discussion on the #2008 and #2066 around removing the lombok dependency, and do understand your reluctance to include a number of 3rd party libraries, but I want to make the case for lombok again.

In my recent java development, lombok has become so common, that I almost consider it a part of the language. It ends up reducing a huge amount of boiler-plate code, and also reduces maintenance overhead - e.g. for toString(), equals, hashcode and constructors.

In most of my other projects, my DTOs look like this:

import lombok.Data

@Data
public class DepositAddress {
  private final String address;
  private final String destinationTag;
}

and that’s it. @Data gives you an RequiredArgs Constructor, Getters, Setters (for non-final fields), equals, hashcode, toString. If you end up adding, removing or moving around fields, the generated toString / equals / hashcode changes automatically.

Also, most IDEs (definitely Eclipse and Idea) now have first class support for lombok, so generated getters / setters & constructors show up correctly while coding in other classes.

https://github.com/timmolter/XChange/pull/2008/commits/7f7b162cbfa434cc3d4196a93e0d0b98bd13f831 is actually a good representation of the before / after state of using lombok.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:11
  • Comments:31 (25 by maintainers)

github_iconTop GitHub Comments

5reactions
timmoltercommented, Mar 6, 2018

I don’t see a real big benefit of introducing lombok at this point. Is just reducing boilerplate code really the only benefit? What about potential drawbacks such as:

  1. incompatibility with jackson marshalling and unmarshalling
  2. Build time
  3. Inconsistency across all modules - some use lombok others not. Do we now need to enforce that people use lombok for all PRs? Or is it an optional?
  4. Newcomers without lombok experience (even if it is easy) will need to learn one additional thing
  5. Who will go and remove all the boilerplate code in the entire project?
  6. Android compatibility issues
  7. Java 9/10 issues
  8. IDE issues
  9. Edge cases in the code where things break (and there is a looooooooot of code in XChange right now)

Since I never used lombok, I don’t have a sense if any of the above issues will arise or not. It seems that the potential risks outweigh the rewards.

4reactions
timmoltercommented, Apr 13, 2018

Well after leaving this open for discussion for some time now, it looks like the majority vote for having lombok as an option, but not as a requirement. Feel free to add it and start using it then…

Read more comments on GitHub >

github_iconTop Results From Across the Web

r/java - Is Lombok in danger of becoming incompatible with ...
Mutability by default is a philosophy that can hide the code smells. Records will hopefully make it attractive to reconsider and restrict ...
Read more >
Decluttering Java - Project Lombok Best Practices - YouTube
Join this live-stream and let's have a debate over when, if, and how to use ... Topics: How do we make Lombok generate...
Read more >
Lombok earthquake break - reNature
We used this distress to reconsider the Dome Lombok project objectives. We see now that we would help the Islanders more by setting...
Read more >
Safety in Lombok - Lombok Forum - Tripadvisor
Safety in Lombok ... But if the tradeoff is security, we might reconsider. ... I personally would not hike alone or let my...
Read more >
Villa Mandala Villa (Lombok) - Deals, Photos & Reviews - Agoda
Special rates on Villa Mandala in Lombok, Indonesia. ... If I could ask for something to change it would be to reconsider the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found