Skip to content

Instantly share code, notes, and snippets.

@sarxos
Last active April 24, 2025 04:29
Show Gist options
  • Save sarxos/9ef9aad8b52e282cfc89fe5da2fb7efc to your computer and use it in GitHub Desktop.
Save sarxos/9ef9aad8b52e282cfc89fe5da2fb7efc to your computer and use it in GitHub Desktop.
CheckerFramework with Lombok and Maven
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.plan.bofime</groupId>
<artifactId>swim-common-parent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>swim-akka-testkit</artifactId>
<name>SWIM Akka Test Kit</name>
<dependencies>
<dependency>
<groupId>org.checkerframework</groupId>
<artifactId>checker-qual</artifactId>
<version>2.6.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.checkerframework</groupId>
<artifactId>checker</artifactId>
<version>2.6.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessors>
<!-- this is important, add lombok processor to the processors list -->
<annotationProcessor>lombok.launch.AnnotationProcessorHider$AnnotationProcessor</annotationProcessor>
<annotationProcessor>org.checkerframework.checker.nullness.NullnessChecker</annotationProcessor>
</annotationProcessors>
</configuration>
</plugin>
</plugins>
</build>
</project>
@TanHonN
Copy link

TanHonN commented Feb 16, 2024

Thanks a lot buddy! I have tried almost one day to adapt the lombok and the checker framework. First I tried to use the lombok-maven-plugin to delombok my code first before the compilation phase, but then I found that the lombok-maven-plugin seems not to work with module-info together, which made me almost give up the checker. The delombok question come from here: [BUG] Delombok not Working with Modules #2829
I was too sad to keep until I saw your answer. Thank you a lot! Btw, how do you find this solution? Can you share your thouth with me? Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment