I have a multi subproject using gradle with the kotlin DSL. I want to use the checkerframework to apply the NullnessChecker.
My gradle config:
plugins {
id("org.checkerframework") version "0.6.35"
}
subprojects {
if (file("src/main/java").isDirectory) {
apply(plugin = "org.checkerframework")
checkerFramework {
checkers = listOf("org.checkerframework.checker.nullness.NullnessChecker")
}
}
...
}
This works if I run my build by:
- Running from the commandline
- Running the Build>>Rebuild Module from within IntelliJ
Which results in an error like:
MyClass.java:29: error: [argument] incompatible argument for parameter variable1 of MyClass.allNull.
new MyClass().allNull(null);
^
Ideally I want IntelliJ to alert me on this as well when/as I change code. Either with the error like above or with squiggly lines.
I have found 2 ways to do this:
With IntelliJ inspections by switching these 2 checkboxes on:
But this means that there are 2 different ways to do null checks and a possibility that what is done by IntelliJ and the checker framework not to be in sync.
By automatically enable the this checkbox
This works as I make changes but it displays the errors in the Auto-build tab
The Auto-build tab does not get display automatically if there are any errors and does not allert me otherwise.
The checkerframework documentation says in section 37.10 'If your project uses a build tool (Ant, Gradle, Maven, etc.), do not use the instructions in this section'.
Is there no other way to run the NullnessChecker in IntelliJ and get squiggly lines?