Background
I am using the checker framework with gradle as so:
build.gradle:
plugins {
id 'org.checkerframework' version '0.6.3'
}
checkerFramework {
checkers = [
'org.checkerframework.checker.nullness.NullnessChecker',
'org.checkerframework.checker.tainting.TaintingChecker'
]
}
apply plugin: 'org.checkerframework'
Right now it is looking at all the classes in my build when I run ./gradlew build. I do not want the checker framework to look at every class but only a particular .java file.
Question
How do I limit the checker framework to running a static analysis on one .java file?
One way is to only run
javacon one class. Your build system has a way to do this, or you can runjavacon the command line.Alternately, use the
-AonlyDefscommand-line option. It takes a regex argument and suppresses all warnings except those in classes whose names match the regex, even if the checker is run on more classes.For example:
javac -processor ... '-AonlyDefs=^mypackage\.MyClass$'