Closed alexvas closed 5 months ago
There are two parts of the Checker Framework that need to be specified:
checker-qual
, which contains only the annotation definitions. It needs to be on the compile classpath of any code that you want to typecheck, since the annotations need to be available at compile time.checker
, which contains the typecheckers themselves. This should not be on the compile classpath, because it's a tool. Therefore, we have a checkerFramework
configuration for this.In your first example, the gradle/libs.versions.toml
file only defines a dependency on the first of these (checker-qual
), and the warning that you're seeing is about the second. In other words, that version catalog only specifies an annotation version but not a checker version, so the plugin uses the default (and so you see the message about No explicit dependency...
).
In your plain build.gradle
example, note that the checkerFramework
dependency's artifact id is checker
and not checker-qual
.
My bad. Thank you. Just for the reference, working example using Gradle version catalog would be:
gradle/libs.versions.toml
:
[versions]
checker-plugin-version = "0.6.40"
checker-framework-version = "3.44.0"
[libraries]
checker-qual = { group = "org.checkerframework", name = "checker-qual", version.ref = "checker-framework-version" }
checker-framework = { group = "org.checkerframework", name = "checker", version.ref = "checker-framework-version" }
[plugins]
checker-plugin = { id = "org.checkerframework", version.ref = "checker-plugin-version" }
and in build.gradle
:
plugins {
id 'java'
alias(libs.plugins.checker.plugin)
}
dependencies {
compileOnly(libs.checker.qual)
testCompileOnly(libs.checker.qual)
checkerFramework(libs.checker.framework)
}
checkerFramework {
checkers = [
'org.checkerframework.checker.nullness.NullnessChecker'
]
}
Please support gradle version catalog to specify a Checker Framework version.
Actual behavior:
Given in
gradle/libs.versions.toml
:and also in
build.gradle
:Then there is a warning when gradle configuring a project:
Given plain string in
build.gradle
:Then no warning issued.
Expected behavior:
There should be no difference specifying Checker framework version either as a plain string or via Gradle version catalog.