Quick revision
The short answer
I would evaluate it as a risk and cost decision rather than a matter of taste: Lombok ties JDK upgrades to its releases, hides generated code from reviews and needs tool configuration, but it removes a lot of boilerplate and has a long record of supporting new JDKs quickly. Modern Java already removes much of the need through records and constructor injection, so the likely answer is a middle path: freeze the allowed annotations, prefer records for new code, and remove Lombok first from libraries shared outside the company. If full removal is chosen, it is done with delombok, module by module, with each step reviewed and measured, never as one big change.
What to remember
In this answer, we treated removing Lombok from 15 million lines as a risk and cost decision. We set the risks of keeping it, coupling to JDK internals, hidden generated code and tool configuration, against its benefits and Lombok's good record with new JDKs, and noted that records and constructor injection already reduce the need. The recommended middle path freezes the allowed set, prefers records for new code, removes Lombok from externally shared libraries and keeps delombok as a tested exit. If full removal is chosen, it is done with delombok module by module, reviewed and measured, never as a big-bang change.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
I would evaluate it as a risk and cost decision rather than a matter of taste: Lombok ties JDK upgrades to its releases, hides generated code from reviews and needs tool configuration, but it removes a lot of boilerplate and has a long record of supporting new JDKs quickly. Modern Java already removes much of the need through records and constructor injection, so the likely answer is a middle path: freeze the allowed annotations, prefer records for new code, and remove Lombok first from libraries shared outside the company. If full removal is chosen, it is done with delombok, module by module, with each step reviewed and measured, never as one big change.
Why this question is asked
Fifteen million lines of code is a size where every decision is expensive and slow to reverse. A proposal to remove a tool used across most of it sounds bold, and the reason given, dependence on compiler internals, is real. Interviewers ask this question at the most senior levels to see whether we can weigh a real technical risk against cost and disruption, decide, and then execute without stopping the organisation. In this answer, we will set out the risks of keeping Lombok, the benefits, how modern Java changes the picture, the options with their costs, a recommendation, and how removal would be executed if chosen.
1Framing the Decision
The first step is to turn "Lombok depends on compiler internals" into concrete questions. How often has that dependence actually hurt us, and how badly? What would it cost to remove Lombok, in engineer time, review load and risk of mistakes? What do we lose if we remove it? And what are the alternatives between keeping everything and removing everything? Answering these with data from our own history, rather than from opinions, is what makes the decision defensible.
I would gather a few numbers: how many JDK upgrades were delayed by Lombok and for how long, how many incidents were caused by generated equals, hashCode or toString, how many modules use which annotations, and how much code delombok would produce. With 15 million lines, delombok might add several million lines of boilerplate, which is itself a cost to read and maintain.
2The Risks of Keeping Lombok
The architect's concern is legitimate. Lombok modifies javac's internal syntax tree, so every JDK upgrade waits for a Lombok release that supports it, and if Lombok's volunteer maintainers ever stopped, we would be stuck on an old JDK or forced into an urgent migration. Generated code is invisible in reviews, so equality, logging and mutability decisions happen without anyone seeing them, which has caused real bugs such as hash codes over mutable fields and toString on lazy JPA associations. And many tools need extra setup: coverage tools need lombok.addLombokGeneratedAnnotation, static analysers and some IDEs need plugins, and annotation processing must be configured correctly in every build.
3The Benefits, and What Modern Java Changes
Lombok also delivers real value. It removes a great deal of boilerplate, which makes classes shorter and diffs smaller. It gives consistent patterns, so every service writes constructor injection and loggers the same way. It costs little effort day to day, and in practice its maintainers have supported new JDKs quickly, often close to their release.
Modern Java reduces the need. Records replace most @Value DTOs and value objects with a language feature that needs no tool. Constructor injection with a single constructor needs no @Autowired, and the IDE can generate constructors, getters and equals in seconds. So the parts of Lombok that are hardest to justify are shrinking anyway, while a few, such as @Slf4j, @RequiredArgsConstructor and @Builder, still save real typing.
| Option | Cost | Risk left | When it fits |
|---|---|---|---|
| Keep everything as is | none now | JDK coupling, hidden equality decisions | never quite: at least freeze usage |
| Freeze and prefer records | low: config and review rules | coupling, on a shrinking footprint | most companies |
| Remove from shared libraries | medium: delombok external APIs | coupling inside services only | libraries used outside the company |
| Remove everywhere | high: millions of lines, review effort | none from Lombok | strong evidence of ongoing harm |
4A Recommended Middle Path
Unless the data shows Lombok has seriously hurt us, I would recommend a middle path. Freeze the allowed set to a few annotations with clear meaning, configured in a central lombok.config that flags the rest. Prefer records and plain Java for new code, so Lombok's footprint shrinks naturally as code is rewritten. Remove Lombok completely from libraries shared outside the company, where generated API is a compatibility risk for customers and they should not need Lombok's quirks to read our sources. And keep delombok working as an exit route, checked in CI once in a while, so that if Lombok ever stops keeping up with the JDK, we have a tested way out.
This answers the architect's real concern, being trapped by a dependency, at a fraction of the cost of removing it everywhere, and it can be revisited each year with fresh data.
5If Removal Is Chosen: Executing It Safely
If leadership decides to remove Lombok, the worst way is a single big change. A safer plan works module by module. For each module, run delombok to produce plain Java, review the generated code once, because this is the moment to fix the equality and toString decisions that were hidden, replace what can be simplified (records for value types, IDE-style constructors), remove the Lombok dependency, and confirm the module builds and its tests pass. Because delombok is automatic, most of the work is review, not writing.
- Run delombokplain Java replaces the annotations
- Review the generated code oncefix hidden equals and
toStringdecisions - Simplify where possiblerecords for value types
- Drop the dependencyprovided or
compileOnlyentry removed - Build, test, measurelines added, build and review time
- Block reintroduction
flagUsage= error for the module
6 steps in order. Play them, or step through them one at a time.
We start with leaf modules and libraries shared outside the company, then move inward. We measure as we go: lines added, build time, review time, and defects found while reviewing, so we can stop or slow down if the cost is higher than expected. A lombok.config with flagUsage = error in finished modules stops Lombok from creeping back.
6Follow-up questions
How would you present this to leadership?
As a risk decision with numbers: how often Lombok has delayed JDK upgrades and caused defects, the estimated cost of each option in engineer-weeks, and the residual risk of each. Then a recommendation, the middle path, with a trigger that would change it, for example a JDK release that Lombok does not support within an agreed time.
What if the architect insists the risk is unacceptable?
I would take the concern seriously and test it: run delombok on a representative module and a CI build on the next early-access JDK. Real evidence of how expensive removal is and how quickly Lombok keeps up usually settles the question better than argument.
Does removing Lombok improve code quality by itself?
Not automatically. It makes generated code visible, which is the moment to fix bad equality and logging decisions. Without that review, we just have the same decisions written out longhand.
7Conclusion
In this answer, we treated removing Lombok from 15 million lines as a risk and cost decision. We set the risks of keeping it, coupling to JDK internals, hidden generated code and tool configuration, against its benefits and Lombok's good record with new JDKs, and noted that records and constructor injection already reduce the need. The recommended middle path freezes the allowed set, prefers records for new code, removes Lombok from externally shared libraries and keeps delombok as a tested exit. If full removal is chosen, it is done with delombok module by module, reviewed and measured, never as a big-bang change.
Open with
I would treat this as a risk decision and start with data rather than opinions. The architect is right that Lombok depends on javac internals, so every JDK upgrade waits for a Lombok release, and generated code hides equality and toString decisions from reviews, plus tools need extra setup.
Then, if they want more
But Lombok also removes a lot of boilerplate, gives consistent patterns, and has a long record of supporting new JDKs quickly.
So I would look at our history: how many JDK upgrades it actually delayed, how many defects came from generated code, which annotations we use, and how much code delombok would add, which for 15 million lines could be millions of lines to maintain.
Modern Java already reduces the need, with records for DTOs and value objects and plain constructor injection.
My likely recommendation is a middle path: freeze a small allowed set in a central lombok.config, prefer records for new code, remove Lombok from libraries shared outside the company, and keep delombok working as a tested exit route, with a clear trigger to revisit, like a JDK that Lombok fails to support in time.
If leadership chooses full removal, I would do it module by module: run delombok, review the generated code once to fix hidden equality and toString decisions, simplify into records where possible, drop the dependency, build and test, measure the cost, and block reintroduction with flagUsage set to error. Never one big-bang change.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Your company has 15 million lines of Java and Lombok is used in most of it. An architect...": https://scrivio-interview-library.netlify.app/java/lombok/477203a9ef/