@@ -33,6 +33,7 @@ plugins {
33
33
// Verification
34
34
checkstyle
35
35
calcite.buildext
36
+ id(" org.checkerframework" ) apply false
36
37
id(" com.github.autostyle" )
37
38
id(" org.nosphere.apache.rat" )
38
39
id(" com.github.spotbugs" )
@@ -63,6 +64,7 @@ val enableSpotBugs = props.bool("spotbugs")
63
64
val skipCheckstyle by props()
64
65
val skipAutostyle by props()
65
66
val skipJavadoc by props()
67
+ val enableCheckerframework by props()
66
68
val enableMavenLocal by props()
67
69
val enableGradleMetadata by props()
68
70
// Inherited from stage-vote-release-plugin: skipSign, useGpgCmd
@@ -495,6 +497,30 @@ allprojects {
495
497
signaturesFiles = files(" $rootDir /src/main/config/forbidden-apis/signatures.txt" )
496
498
}
497
499
500
+ if (enableCheckerframework) {
501
+ apply (plugin = " org.checkerframework" )
502
+ dependencies {
503
+ " checkerFramework" (" org.checkerframework:checker:${" checkerframework" .v} " )
504
+ // CheckerFramework annotations might be used in the code as follows:
505
+ // dependencies {
506
+ // "compileOnly"("org.checkerframework:checker-qual")
507
+ // "testCompileOnly"("org.checkerframework:checker-qual")
508
+ // }
509
+ if (JavaVersion .current() == JavaVersion .VERSION_1_8 ) {
510
+ // only needed for JDK 8
511
+ " checkerFrameworkAnnotatedJDK" (" org.checkerframework:jdk8" )
512
+ }
513
+ }
514
+ configure< org.checkerframework.gradle.plugin.CheckerFrameworkExtension > {
515
+ applyToSubprojects = false
516
+ skipVersionCheck = true
517
+ // See https://checkerframework.org/manual/#introduction
518
+ checkers.add(" org.checkerframework.checker.nullness.NullnessChecker" )
519
+ checkers.add(" org.checkerframework.checker.optional.OptionalChecker" )
520
+ checkers.add(" org.checkerframework.checker.regex.RegexChecker" )
521
+ }
522
+ }
523
+
498
524
tasks {
499
525
configureEach<Jar > {
500
526
manifest {
0 commit comments