javalombokjdk-24

Java web-app cannot compile with JDK 24: java: java.lang.ExceptionInInitializerError , com.sun.tools.javac.code.TypeTag :: UNKNOWN


I have file maven.pom

<dependency>
    <groupId>org.projectlombok</groupId>
    <artifactId>lombok</artifactId>
</dependency>

I use many JDKs (Adoptium, Amazon Correcto) but did not success. Error

java: java.lang.ExceptionInInitializerError
com.sun.tools.javac.code.TypeTag :: UNKNOWN

enter image description here

How to fix it?


Solution

  • I researched many days. Because Lombok did not support, even latest version of Lombok at the time of writing is

    <!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <version>1.18.36</version>
        <scope>provided</scope>
    </dependency>
    

    (did not work)

    enter image description here

    . Please wait next release. See https://github.com/projectlombok/lombok/tags

    https://github.com/projectlombok/lombok/pull/3840 (Please keep this question and answer, it will help many others who looking for solution, exactly looking for reason why error happens).

    More information: Even use JDK 24, and set Java language level is 23, it will still cause error, must use JDK 23 with Java language level 23 with latest version of Lombok (at the time of writing).