Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import junitbuild.extensions.dependencyFromLibs
import net.ltgt.gradle.errorprone.errorprone
import net.ltgt.gradle.nullaway.nullaway
import org.gradle.jvm.toolchain.JvmImplementation.J9

plugins {
`java-library`
Expand All @@ -16,17 +17,10 @@ dependencies {

tasks.withType<JavaCompile>().configureEach {
options.errorprone {
val shouldDisableErrorProne = java.toolchain.implementation.orNull == JvmImplementation.J9
if (name == "compileJava" && !shouldDisableErrorProne) {
disable(
"AnnotateFormatMethod", // We don`t want to use ErrorProne's annotations.
"BadImport", // This check is opinionated wrt. which method names it considers unsuitable for import which includes a few of our own methods in `ReflectionUtils` etc.
"DoNotCallSuggester", // We don`t want to use ErrorProne's annotations.
"ImmutableEnumChecker", // We don`t want to use ErrorProne's annotations.
"InlineMeSuggester", // We don`t want to use ErrorProne's annotations.
"MissingSummary", // Produces a lot of findings that we consider to be false positives, for example for package-private classes and methods.
"StringSplitter", // We don`t want to use Guava.
"UnnecessaryLambda", // The findings of this check are subjective because a named constant can be more readable in many cases.
val enableErrorProne = java.toolchain.implementation.orNull != J9
if (name == "compileJava" && enableErrorProne) {
disableAllWarnings = true // considering this immense spam burden, remove this once to fix dedicated flaw. https://github.com/diffplug/spotless/pull/2766
disable( // We don`t want to use ErrorProne's annotations.
// picnic (https://error-prone.picnic.tech)
"ConstantNaming",
"DirectReturn", // We don`t want to use this: https://github.com/junit-team/junit-framework/pull/5006#discussion_r2403984446
Expand All @@ -45,18 +39,22 @@ tasks.withType<JavaCompile>().configureEach {
error(
"CanonicalAnnotationSyntax",
"IsInstanceLambdaUsage",
"MissingOverride",
"PackageLocation",
"RedundantStringConversion",
"RedundantStringEscape",
"SelfAssignment",
"StringCharset",
"StringJoin",
Comment on lines +42 to +48
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to consider these, might nice to have, idk.

)
} else {
disableAllChecks = true
}
nullaway {
if (shouldDisableErrorProne) {
disable()
} else {
if (enableErrorProne) {
enable()
} else {
disable()
}
onlyNullMarked = true
isJSpecifyMode = true
Expand Down