Understanding the Incompatibility of Lombok's Access to jdk.compiler's Internal Packages with Java 16

Published on 2024.02.19


Lombok is a popular Java library that helps reduce boilerplate code by providing annotations to generate getters, setters, constructors, and other commonly used code snippets. However, with the release of Java 16, an incompatibility issue has arisen between Lombok and the internal packages of jdk.compiler. This article aims to provide an understanding of the issue and suggest possible workarounds.

The Incompatibility Issue

Java 16 introduced new features and internal changes to the compiler implementation, including modifications to the internal package com.sun.tools.javac and its sub-packages. Lombok, being a library that heavily relies on these internal packages, was developed to work with previous versions of Java but has now become incompatible with Java 16 due to the structural and behavioral changes.

Impact on Lombok Users

Lombok users who upgrade to Java 16 may encounter compilation errors or unexpected behavior when using Lombok annotations. This incompatibility issue prevents Lombok's annotation processors from accessing and modifying certain internal compiler classes, causing conflicts and compilation failures.

Possible Workarounds

  1. Downgrade to an earlier Java version: If possible, consider downgrading to a Java version supported by Lombok to avoid the compatibility issue altogether. This may involve reverting to the latest LTS (Long-Term Support) release or an older stable version of Java.

  2. Use alternative libraries or manual code generation: Explore alternative libraries or manual code generation techniques as a replacement for Lombok. While this might involve more effort, it provides greater control over the generated code and eliminates the reliance on Lombok's internal mechanisms.

  3. Wait for an updated version of Lombok: The Lombok community is actively working on resolving this incompatibility issue with Java 16. Keep an eye on the official Lombok website or repository for updates and releases that address this specific problem.


Understanding the incompatibility between Lombok and Java 16's internal compiler packages is crucial for developers using Lombok in their projects. By being aware of this issue, developers can plan their Java version upgrade strategy accordingly and explore alternative solutions or wait for Lombok updates. Remember to regularly check for updates and news from the Lombok community to stay informed about any advancements on this matter.