Add errorprone and fix warnings/errors

The compiler will also treat all warnings as errors from now on.
This commit is contained in:
Alexander Söderberg 2020-10-23 10:20:45 +02:00 committed by Alexander Söderberg
parent 6ffee9d04f
commit cfac2639ad
101 changed files with 309 additions and 146 deletions

View file

@ -15,6 +15,7 @@ plugins {
id 'java-library'
id 'com.github.johnrengelman.shadow' version '6.1.0'
id 'de.marcphilipp.nexus-publish' version '0.4.0'
id 'net.ltgt.errorprone' version '1.3.0'
}
apply from: 'scripts/dependencies.gradle'
@ -59,6 +60,7 @@ subprojects {
apply plugin: 'java-library'
apply plugin: 'signing'
apply plugin: 'de.marcphilipp.nexus-publish'
apply plugin: 'net.ltgt.errorprone'
test {
useJUnitPlatform()
@ -69,6 +71,21 @@ subprojects {
withJavadocJar()
}
tasks.withType(JavaCompile).configureEach {
options.compilerArgs << "-Xlint:all" << "-Xlint:-processing" << "-Werror"
options.errorprone {
/* These are just annoying */
disable(
"JdkObsolete",
"FutureReturnValueIgnored",
"ImmutableEnumChecker",
"StringSplitter",
"EqualsGetClass",
"CatchAndPrintStackTrace"
)
}
}
repositories {
mavenLocal()
mavenCentral()
@ -115,6 +132,8 @@ subprojects {
compileOnly "org.checkerframework:checker-qual:${vers['checker-qual']}"
api "io.leangen.geantyref:geantyref:${vers['geantyref']}"
testImplementation "org.junit.jupiter:junit-jupiter-engine:${vers['jupiter-engine']}"
errorprone "com.google.errorprone:error_prone_core:${vers['errorprone']}"
errorproneJavac "com.google.errorprone:javac:9+181-r4173-1"
}
nexusPublishing {
@ -180,4 +199,3 @@ subprojects {
}
}