Skip to content

Commit 67b10eb

Browse files
authored
Add error-prone.picnic.tech featuring RedundantStringConversion (#5006)
1 parent d413411 commit 67b10eb

File tree

3 files changed

+34
-28
lines changed

3 files changed

+34
-28
lines changed

gradle/libs.versions.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ bndlib = { module = "biz.aQute.bnd:biz.aQute.bndlib", version.ref = "bnd" }
3232
checkstyle = { module = "com.puppycrawl.tools:checkstyle", version.ref = "checkstyle" }
3333
classgraph = { module = "io.github.classgraph:classgraph", version = "4.8.184" }
3434
commons-io = { module = "commons-io:commons-io", version = "2.20.0" }
35-
errorProne-core = { module = "com.google.errorprone:error_prone_core", version = "2.42.0" }
35+
error-prone-contrib = { module = "tech.picnic.error-prone-support:error-prone-contrib", version = "0.25.0" }
36+
error-prone-core = { module = "com.google.errorprone:error_prone_core", version = "2.42.0" }
3637
fastcsv = { module = "de.siegmar:fastcsv", version = "4.1.0" }
3738
groovy = { module = "org.apache.groovy:groovy", version = "5.0.1" }
3839
groovy2-bom = { module = "org.codehaus.groovy:groovy-bom", version = "2.5.23" }

gradle/plugins/common/src/main/kotlin/junitbuild.java-nullability-conventions.gradle.kts

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,49 +9,53 @@ plugins {
99
}
1010

1111
dependencies {
12-
errorprone(dependencyFromLibs("errorProne-core"))
12+
errorprone(dependencyFromLibs("error-prone-contrib"))
13+
errorprone(dependencyFromLibs("error-prone-core"))
1314
errorprone(dependencyFromLibs("nullaway"))
1415
constraints {
1516
errorprone("com.google.guava:guava") {
1617
version {
1718
require("33.4.8-jre")
1819
}
1920
because("Older versions use deprecated methods in sun.misc.Unsafe")
21+
// https://github.com/junit-team/junit-framework/pull/5039#discussion_r2414490581
2022
}
2123
}
2224
}
2325

24-
nullaway {
25-
onlyNullMarked = true
26-
}
27-
2826
tasks.withType<JavaCompile>().configureEach {
2927
options.errorprone {
3028
val shouldDisableErrorProne = java.toolchain.implementation.orNull == JvmImplementation.J9
3129
if (name == "compileJava" && !shouldDisableErrorProne) {
3230
disable(
33-
34-
// This check is opinionated wrt. which method names it considers unsuitable for import which includes
35-
// a few of our own methods in `ReflectionUtils` etc.
36-
"BadImport",
37-
38-
// The findings of this check are subjective because a named constant can be more readable in many cases
39-
"UnnecessaryLambda",
40-
41-
// Resolving findings for these checks requires ErrorProne's annotations which we don't want to use
42-
"AnnotateFormatMethod",
43-
"DoNotCallSuggester",
44-
"InlineMeSuggester",
45-
"ImmutableEnumChecker",
46-
47-
// Resolving findings for this check requires using Guava which we don't want to use
48-
"StringSplitter",
49-
50-
// Produces a lot of findings that we consider to be false positives, for example for package-private
51-
// classes and methods
52-
"MissingSummary",
31+
"AnnotateFormatMethod", // We don`t want to use ErrorProne's annotations.
32+
"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.
33+
"DoNotCallSuggester", // We don`t want to use ErrorProne's annotations.
34+
"ImmutableEnumChecker", // We don`t want to use ErrorProne's annotations.
35+
"InlineMeSuggester", // We don`t want to use ErrorProne's annotations.
36+
"MissingSummary", // Produces a lot of findings that we consider to be false positives, for example for package-private classes and methods.
37+
"StringSplitter", // We don`t want to use Guava.
38+
"UnnecessaryLambda", // The findings of this check are subjective because a named constant can be more readable in many cases.
39+
// picnic (https://error-prone.picnic.tech)
40+
"ConstantNaming",
41+
"DirectReturn", // https://github.com/junit-team/junit-framework/pull/5006#discussion_r2403984446
42+
"FormatStringConcatenation",
43+
"IdentityConversion",
44+
"LexicographicalAnnotationAttributeListing",
45+
"LexicographicalAnnotationListing",
46+
"MissingTestCall",
47+
"NestedOptionals",
48+
"NonStaticImport",
49+
"OptionalOrElseGet",
50+
"PrimitiveComparison",
51+
"StaticImport",
52+
"TimeZoneUsage",
53+
)
54+
error(
55+
"PackageLocation",
56+
"RedundantStringConversion",
57+
"RedundantStringEscape",
5358
)
54-
error("PackageLocation")
5559
} else {
5660
disableAllChecks = true
5761
}
@@ -61,6 +65,7 @@ tasks.withType<JavaCompile>().configureEach {
6165
} else {
6266
enable()
6367
}
68+
onlyNullMarked = true
6469
isJSpecifyMode = true
6570
customContractAnnotations.add("org.junit.platform.commons.annotation.Contract")
6671
checkContracts = true

junit-jupiter-engine/src/main/java/org/junit/jupiter/engine/extension/PreInterruptThreadDumpPrinter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public void beforeThreadInterrupt(PreInterruptContext preInterruptContext, Exten
4949
sb.append(NL);
5050
// Use the same prefix as java.lang.Throwable.printStackTrace(PrintStreamOrWriter)
5151
sb.append("\tat ");
52-
sb.append(stackTraceElement.toString());
52+
sb.append(stackTraceElement);
5353
}
5454
sb.append(NL);
5555
}

0 commit comments

Comments
 (0)