@@ -9,8 +9,10 @@ plugins {
99}
1010
1111dependencies {
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,127 @@ nullaway {
2729
2830tasks.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 and DirectReturn 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+ " 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-
3493 // This check is opinionated wrt. which method names it considers unsuitable for import which includes
3594 // a few of our own methods in `ReflectionUtils` etc.
3695 " BadImport" ,
37-
3896 // The findings of this check are subjective because a named constant can be more readable in many cases
3997 " UnnecessaryLambda" ,
40-
4198 // Resolving findings for these checks requires ErrorProne's annotations which we don't want to use
4299 " AnnotateFormatMethod" ,
43100 " DoNotCallSuggester" ,
44101 " InlineMeSuggester" ,
45102 " ImmutableEnumChecker" ,
46-
47103 // Resolving findings for this check requires using Guava which we don't want to use
48104 " StringSplitter" ,
49-
50105 // Produces a lot of findings that we consider to be false positives, for example for package-private
51106 // classes and methods
52107 " MissingSummary" ,
108+ // picnic (https://error-prone.picnic.tech)
109+ // rejected:
110+ " DirectReturn" , // https://github.com/junit-team/junit-framework/pull/5006#discussion_r2403984446
111+ // TBD:
112+ " AddNullMarkedToPackageInfo" ,
113+ " AmbiguousJsonCreator" ,
114+ " AssertJNullnessAssertion" ,
115+ " AutowiredConstructor" ,
116+ " CanonicalAnnotationSyntax" ,
117+ " CanonicalClassNameUsage" ,
118+ " ClassCastLambdaUsage" ,
119+ " CollectorMutability" ,
120+ " ConstantNaming" ,
121+ " DeadException" ,
122+ " EagerStringFormatting" ,
123+ " EmptyMonoZip" ,
124+ " ExplicitArgumentEnumeration" ,
125+ " ExplicitEnumOrdering" ,
126+ " FluxFlatMapUsage" ,
127+ " FluxImplicitBlock" ,
128+ " FormatStringConcatenation" ,
129+ " IdentityConversion" ,
130+ " ImmutablesSortedSetComparator" ,
131+ " IsInstanceLambdaUsage" ,
132+ " JUnitClassModifiers" ,
133+ " JUnitMethodDeclaration" ,
134+ " JUnitNullaryParameterizedTestDeclaration" ,
135+ " JUnitValueSource" ,
136+ " LexicographicalAnnotationAttributeListing" ,
137+ " LexicographicalAnnotationListing" ,
138+ " MockitoMockClassReference" ,
139+ " MockitoStubbing" ,
140+ " MongoDBTextFilterUsage" ,
141+ " NestedOptionals" ,
142+ " NestedPublishers" ,
143+ " NonEmptyMono" ,
144+ " NonStaticImport" ,
145+ " OptionalOrElseGet" ,
146+ " PrimitiveComparison" ,
147+ " RequestMappingAnnotation" ,
148+ " Slf4jLogStatement" ,
149+ " Slf4jLoggerDeclaration" ,
150+ " SpringMvcAnnotation" ,
151+ " StaticImport" ,
152+ " TimeZoneUsage" ,
53153 )
54154 error(" PackageLocation" )
55155 } else {
0 commit comments