11import buildlogic.stringyLibs
22import buildlogic.getLibrary
3+ import net.ltgt.gradle.errorprone.errorprone
34
45plugins {
56 id(" eclipse" )
67 id(" idea" )
78 id(" checkstyle" )
9+ id(" net.ltgt.errorprone" )
810 id(" buildlogic.common" )
911}
1012
1315 .matching { it.name == " compileJava" || it.name == " compileTestJava" }
1416 .configureEach {
1517 val disabledLint = listOf (
16- " processing" , " path" , " fallthrough" , " serial" , " overloads" , " this-escape"
18+ " processing" , " path" , " fallthrough" , " serial" , " overloads" , " this-escape" ,
1719 )
1820 options.release.set(21 )
1921 options.compilerArgs.addAll(listOf (" -Xlint:all" ) + disabledLint.map { " -Xlint:-$it " })
@@ -23,11 +25,24 @@ tasks
2325 if (project.name.contains(" -core" )) {
2426 options.compilerArgs.add(" -Werror" )
2527 }
28+ options.errorprone {
29+ // We use -Werror, so we don't need errorprone to fail the build separately
30+ allErrorsAsWarnings = true
31+ // Obviously we don't need to fix generated code
32+ disableWarningsInGeneratedCode = true
33+ // We use reference equality intentionally in several places
34+ // Perhaps we should consider testing the performance impact of using .equals() instead?
35+ // Especially for the types that are only compared by reference equality, we could consider
36+ // removing their .equals() implementations to avoid confusion.
37+ disable(" ReferenceEquality" )
38+ // We're on JDK 21, so System.console() can still be null
39+ disable(" SystemConsoleNull" )
40+ }
2641 }
2742
2843configure<CheckstyleExtension > {
2944 configFile = rootProject.file(" config/checkstyle/checkstyle.xml" )
30- toolVersion = " 10.16.0 "
45+ toolVersion = " 12.3.1 "
3146}
3247
3348tasks.withType<Test >().configureEach {
@@ -38,6 +53,8 @@ tasks.withType<Test>().configureEach {
3853
3954dependencies {
4055 " compileOnly" (stringyLibs.getLibrary(" jspecify" ))
56+ " compileOnly" (stringyLibs.getLibrary(" errorprone-annotations" ))
57+ " errorprone" (stringyLibs.getLibrary(" errorprone-core" ))
4158 " testImplementation" (platform(stringyLibs.getLibrary(" junit-bom" )))
4259 " testImplementation" (stringyLibs.getLibrary(" junit-jupiter-api" ))
4360 " testImplementation" (stringyLibs.getLibrary(" junit-jupiter-params" ))
0 commit comments