Lombok and Java 23 compilation issues

Updated: 2024-11-23

When you upgrade to Java 23 you could encounter few issues if you are using Lombok and Maven.

Markdown issue

Java 23 introduces the Markdown support for JavaDoc: https://openjdk.org/jeps/467, your method comments could look like something like this:

///   - If two objects are equal according to the 
///     [equals][#equals(Object)] method, then calling the 
///     `hashCode` method on each of the two objects must produce the 
///     same integer result. 

Lombok had issues understanding this (https://github.com/projectlombok/lombok/issues/3722#issuecomment-2420830892), but a fix has been published, updating to a recent version of Lombok (>= 1.18.36) should solve the problem.

Maven doesn't compile your project anymore : cannot find symbol

This is more annoying, maybe you don't write comments in your code, but definitely you need to compile it.

It seems that gradle users are not impacted and this is specific to maven.

If you get the following exception for the Lombok annotations: cannot find symbol when you build, you have to modify the configuration of your build.

In your pom.xml you have to add:

<maven.compiler.proc>full</maven.compiler.proc> 

This property instructs explicitly maven to process the annotations during the compilation ad to generate the additional files based on the annotations.

Java 23 deactivated the annotation processing

This is a 'breaking' change introduced by Oracle since Java 23, javac was previously processing the annotations by default.

Here you can find the documentation of Oracle: https://www.oracle.com/java/technologies/javase/23all-relnotes.html

As of JDK 23, annotation processing is only run with some explicit configuration of annotation processing or with an explicit request to run annotation processing on the javac command line. This is a change in behavior from the existing default of looking to run annotation processing by searching the class path for processors without any explicit annotation processing related options needing to be present.

Other information can be found here:

https://bugs.java.com/bugdatabase/view_bug?bug_id=JDK-8321314


WebApp built by Marco using SpringBoot 3.2.4 and Java 21, in a Server in Switzerland