I’m trying to get our warning count down. (To zero, if possible, but let’s start by trying to get it down to 4 digits.) One of the big offenders is ANTLR-generated Java code, because it seems to generate code optimised to maximise the number of warnings. (I even see redundant casts to Object.)
Thing is, though, it looks like their generated class does have a @SuppressWarnings("all")
annotation on it, and when I run javac myself, does suppress all warnings.
When I run gradle’s compileJava
, though, I still get all the warnings, despite the suppression.
The only settings I’m currently using are:
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:cast"
}
Is there any reason why this would cause Gradle to run javac in some weird way which causes it to ignore the suppression? Because otherwise, I can’t figure out why the warnings only occur when Gradle is running javac, while running it myself does work as expected.