Skip to content

Commit bad204a

Browse files
Vincent PotucekPankraz76
authored andcommitted
Add error-prone.picnic.tech
1 parent 805adad commit bad204a

File tree

4 files changed

+121
-6
lines changed

4 files changed

+121
-6
lines changed

documentation/src/main/java/example/domain/Person.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ public int hashCode() {
5555
final int prime = 31;
5656
int result = 1;
5757
result = prime * result + ((firstName == null) ? 0 : firstName.hashCode());
58-
result = prime * result + ((lastName == null) ? 0 : lastName.hashCode());
59-
return result;
58+
return prime * result + ((lastName == null) ? 0 : lastName.hashCode());
59+
6060
}
6161

6262
@Override

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: 114 additions & 1 deletion
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,6 +29,65 @@ 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 picnic works
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+
"DirectReturn," + // why only this working?
51+
"EagerStringFormatting," +
52+
"EmptyMethod," +
53+
"EmptyMonoZip," +
54+
"ExplicitArgumentEnumeration," +
55+
"ExplicitEnumOrdering," +
56+
"FluxFlatMapUsage," +
57+
"FluxImplicitBlock," +
58+
"FormatStringConcatenation," +
59+
"IdentityConversion," +
60+
"ImmutablesSortedSetComparator," +
61+
"IsInstanceLambdaUsage," +
62+
"JUnitClassModifiers," +
63+
"JUnitMethodDeclaration," +
64+
"JUnitNullaryParameterizedTestDeclaration," +
65+
"JUnitValueSource," +
66+
"LexicographicalAnnotationAttributeListing," +
67+
"LexicographicalAnnotationListing," +
68+
"MissingOverride," +
69+
"MockitoMockClassReference," +
70+
"MockitoStubbing," +
71+
"MongoDBTextFilterUsage," +
72+
"NestedOptionals," +
73+
"NestedPublishers," +
74+
"NonEmptyMono," +
75+
"NonStaticImport," +
76+
"OptionalOrElseGet," +
77+
"PrimitiveComparison," +
78+
"RedundantStringConversion," +
79+
"RedundantStringEscape," +
80+
"RefasterAnyOfUsage," +
81+
"RequestMappingAnnotation," +
82+
"RequestParamType," +
83+
"Slf4jLogStatement," +
84+
"Slf4jLoggerDeclaration," +
85+
"SpringMvcAnnotation," +
86+
"StaticImport," +
87+
"StringJoin," + // why only this working?
88+
"TimeZoneUsage"
89+
);
90+
}
3091
val shouldDisableErrorProne = java.toolchain.implementation.orNull == JvmImplementation.J9
3192
if (name == "compileJava" && !shouldDisableErrorProne) {
3293
disable(
@@ -50,6 +111,58 @@ tasks.withType<JavaCompile>().configureEach {
50111
// Produces a lot of findings that we consider to be false positives, for example for package-private
51112
// classes and methods
52113
"MissingSummary",
114+
115+
// picnic (TBD) https://error-prone.picnic.tech
116+
"AddNullMarkedToPackageInfo",
117+
"AmbiguousJsonCreator",
118+
"AssertJNullnessAssertion",
119+
"AutowiredConstructor",
120+
"CanonicalAnnotationSyntax",
121+
"CanonicalClassNameUsage",
122+
"ClassCastLambdaUsage",
123+
"CollectorMutability",
124+
"ConstantNaming",
125+
"DeadException",
126+
"DefaultCharset",
127+
"EagerStringFormatting",
128+
"EmptyMethod",
129+
"EmptyMonoZip",
130+
"ExplicitArgumentEnumeration",
131+
"ExplicitEnumOrdering",
132+
"FluxFlatMapUsage",
133+
"FluxImplicitBlock",
134+
"FormatStringConcatenation",
135+
"IdentityConversion",
136+
"ImmutablesSortedSetComparator",
137+
"IsInstanceLambdaUsage",
138+
"JUnitClassModifiers",
139+
"JUnitMethodDeclaration",
140+
"JUnitNullaryParameterizedTestDeclaration",
141+
"JUnitValueSource",
142+
"LexicographicalAnnotationAttributeListing",
143+
"LexicographicalAnnotationListing",
144+
"LexicographicalAnnotationListing",
145+
"MissingOverride",
146+
"MockitoMockClassReference",
147+
"MockitoStubbing",
148+
"MongoDBTextFilterUsage",
149+
"NestedOptionals",
150+
"NestedPublishers",
151+
"NonEmptyMono",
152+
"NonStaticImport",
153+
"OptionalOrElseGet",
154+
"PrimitiveComparison",
155+
"RedundantStringConversion",
156+
"RedundantStringEscape",
157+
"RequestMappingAnnotation",
158+
"RequestParamType",
159+
"Slf4jLogStatement",
160+
"Slf4jLoggerDeclaration",
161+
"SpringMvcAnnotation",
162+
"StaticImport",
163+
"TimeZoneUsage",
164+
// "DirectReturn", fixed
165+
// "StringJoin", fixed
53166
)
54167
error("PackageLocation")
55168
} else {

junit-platform-commons/src/main/java/org/junit/platform/commons/util/ModuleUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,8 @@ List<Class<?>> scan(ModuleReference reference) {
231231
*/
232232
private String className(String resourceName) {
233233
resourceName = resourceName.substring(0, resourceName.length() - 6); // 6 = ".class".length()
234-
resourceName = resourceName.replace('/', '.');
235-
return resourceName;
234+
return resourceName.replace('/', '.');
235+
236236
}
237237

238238
/**

0 commit comments

Comments
 (0)