I am integrating the Nullness Checker from the checker Framework to our Java project built with Maven. I configured the annotation processor for maven-compiler-plugin
plugin. Everything works fine except that I don't want it run through the generated code.
Something along the lines of excluding the use of these annotation processors for code in target
directory or for a specific java package could help, but I couldn't figure out how to do that.
I also tried to find a configuration for the Nullness Checker itself to exclude directories or java packages. Again I couldn't find anything.
Here's my plugin config:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.checkerframework</groupId>
<artifactId>checker</artifactId>
<version>3.4.0</version>
</path>
</annotationProcessorPaths>
<annotationProcessors>
<annotationProcessor>org.checkerframework.checker.nullness.NullnessChecker</annotationProcessor>
</annotationProcessors>
</configuration>
</plugin>
If you want to exclude certain files from the javac
invocation that runs an annotation processor, that is a question about Maven that already has an answer here.
If you want to run javac
on all files when running the annotation processor, but you want to suppress all warnings regarding certain files, use the -skipDefs
command-line argument. Using -skipDefs
makes the Nullness Checker issue the same warnings as if it had not been run on certain files.