Skip to content

Commit c36f592

Browse files
author
Vincent Potucek
committed
Add error-prone.picnic.tech
1 parent 805adad commit c36f592

File tree

3 files changed

+114
-23
lines changed

3 files changed

+114
-23
lines changed

gradle/libs.versions.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ bndlib = { module = "biz.aQute.bnd:biz.aQute.bndlib", version.ref = "bnd" }
3131
checkstyle = { module = "com.puppycrawl.tools:checkstyle", version.ref = "checkstyle" }
3232
classgraph = { module = "io.github.classgraph:classgraph", version = "4.8.181" }
3333
commons-io = { module = "commons-io:commons-io", version = "2.20.0" }
34-
errorProne-core = { module = "com.google.errorprone:error_prone_core", version = "2.42.0" }
34+
error-prone-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+
refaster-runner = { module = "tech.picnic.error-prone-support:refaster-runner", version = "0.25.0" }
3537
fastcsv = { module = "de.siegmar:fastcsv", version = "4.0.0" }
3638
groovy = { module = "org.apache.groovy:groovy", version = "5.0.1" }
3739
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: 110 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ 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"))
15+
errorprone(dependencyFromLibs("refaster-runner"))
1416
constraints {
1517
errorprone("com.google.guava:guava") {
1618
version {
@@ -27,29 +29,116 @@ nullaway {
2729

2830
tasks.withType<JavaCompile>().configureEach {
2931
options.errorprone {
32+
disableWarningsInGeneratedCode = true
33+
allErrorsAsWarnings = true
34+
errorproneArgs.add("-XepOpt:Refaster:NamePattern=^(?!.*Rules\\\$).*") // not complain; reduce after merge.
35+
if (System.getenv("IN_PLACE")?.toBooleanStrictOrNull() ?: false) {
36+
errorproneArgs.addAll(
37+
"-XepPatchLocation:IN_PLACE", // somehow only certain picnic rules apply...
38+
"-XepPatchChecks:" +
39+
"AddNullMarkedToPackageInfo," +
40+
"AmbiguousJsonCreator," +
41+
"AssertJNullnessAssertion," +
42+
"AutowiredConstructor," +
43+
"CanonicalAnnotationSyntax," +
44+
"CanonicalClassNameUsage," +
45+
"ClassCastLambdaUsage," +
46+
"CollectorMutability," +
47+
"ConstantNaming," +
48+
"DeadException," +
49+
"DefaultCharset," +
50+
"EagerStringFormatting," +
51+
"EmptyMethod," +
52+
"EmptyMonoZip," +
53+
"ExplicitArgumentEnumeration," +
54+
"ExplicitEnumOrdering," +
55+
"FluxFlatMapUsage," +
56+
"FluxImplicitBlock," +
57+
"FormatStringConcatenation," +
58+
"IdentityConversion," +
59+
"ImmutablesSortedSetComparator," +
60+
"IsInstanceLambdaUsage," +
61+
"JUnitClassModifiers," +
62+
"JUnitMethodDeclaration," +
63+
"JUnitNullaryParameterizedTestDeclaration," +
64+
"JUnitValueSource," +
65+
"LexicographicalAnnotationAttributeListing," +
66+
"LexicographicalAnnotationListing," +
67+
"MissingOverride," +
68+
"MockitoMockClassReference," +
69+
"MockitoStubbing," +
70+
"MongoDBTextFilterUsage," +
71+
"NestedOptionals," +
72+
"NestedPublishers," +
73+
"NonEmptyMono," +
74+
"NonStaticImport," +
75+
"OptionalOrElseGet," +
76+
"PrimitiveComparison," +
77+
"RedundantStringConversion," +
78+
"RedundantStringEscape," +
79+
"RefasterAnyOfUsage," +
80+
"RequestMappingAnnotation," +
81+
"RequestParamType," +
82+
"Slf4jLogStatement," +
83+
"Slf4jLoggerDeclaration," +
84+
"SpringMvcAnnotation," +
85+
"StaticImport," +
86+
"StringJoin," +
87+
"TimeZoneUsage"
88+
)
89+
}
3090
val shouldDisableErrorProne = java.toolchain.implementation.orNull == JvmImplementation.J9
3191
if (name == "compileJava" && !shouldDisableErrorProne) {
3292
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",
93+
"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.
94+
"UnnecessaryLambda", // The findings of this check are subjective because a named constant can be more readable in many cases.
95+
"AnnotateFormatMethod", // We don't want to use ErrorProne's annotations.
96+
"DoNotCallSuggester", // TBD
97+
"InlineMeSuggester", // TBD
98+
"ImmutableEnumChecker", // TBD
99+
"StringSplitter", // We don't want to use Guava.
100+
"MissingSummary", // Produces a lot of findings that we consider to be false positives, for example for package-private classes and methods.
101+
"DirectReturn", // https://github.com/junit-team/junit-framework/pull/5006#discussion_r2403984446
102+
// might consider: https://error-prone.picnic.tech
103+
"AddNullMarkedToPackageInfo",
104+
"AmbiguousJsonCreator",
105+
"AssertJNullnessAssertion",
106+
"AutowiredConstructor",
107+
"CanonicalAnnotationSyntax",
108+
"CanonicalClassNameUsage",
109+
"ClassCastLambdaUsage",
110+
"CollectorMutability",
111+
"ConstantNaming",
112+
"DeadException",
113+
"EagerStringFormatting",
114+
"EmptyMonoZip",
115+
"ExplicitArgumentEnumeration",
116+
"ExplicitEnumOrdering",
117+
"FluxFlatMapUsage",
118+
"FluxImplicitBlock",
119+
"FormatStringConcatenation",
120+
"IdentityConversion",
121+
"ImmutablesSortedSetComparator",
122+
"IsInstanceLambdaUsage",
123+
"JUnitClassModifiers",
124+
"JUnitMethodDeclaration",
125+
"JUnitNullaryParameterizedTestDeclaration",
126+
"JUnitValueSource",
127+
"LexicographicalAnnotationAttributeListing",
128+
"LexicographicalAnnotationListing",
129+
"MockitoMockClassReference",
130+
"MockitoStubbing",
131+
"NestedOptionals",
132+
"NestedPublishers",
133+
"NonEmptyMono",
134+
"NonStaticImport",
135+
"OptionalOrElseGet",
136+
"PrimitiveComparison",
137+
"RequestMappingAnnotation",
138+
"Slf4jLogStatement",
139+
"Slf4jLoggerDeclaration",
140+
"StaticImport",
141+
"TimeZoneUsage",
53142
)
54143
error("PackageLocation")
55144
} else {

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)