Apache Solr open-source search software
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
def skipReason
if (rootProject.usesAltJvm) {
skipReason = "won't work with alternative java toolchain"
}
if (!propertyOrDefault("validation.errorprone", isCIBuild).asBoolean()) {
skipReason =
"skipped on builds not running inside CI environments, pass -Pvalidation.errorprone=true to enable"
}
if (skipReason) {
configure(rootProject) {
task errorProneSkipped() {
doFirst {
logger.warn("WARNING: errorprone disabled (${skipReason})")
}
}
}
}
allprojects {prj ->
plugins.withType(JavaPlugin) {
// LUCENE-9650: Errorprone does not work when running as a plugin inside a forked Javac process.
// Javac running inside Gradle works, because we have additional module system opens in place.
if (skipReason) {
tasks.withType(JavaCompile) {task -> task.dependsOn ":errorProneSkipped"}
// Error prone plugin adds error prone to test classpath. We need to add it here too
// (manually) so that lockfiles are consistent with or without error prone.
configurations {
errorprone
}
dependencies {
errorprone platform(project(":platform"))
errorprone libs.google.errorprone.core
}
configurations.annotationProcessor.extendsFrom(configurations.errorprone)
configurations.testAnnotationProcessor.extendsFrom(configurations.errorprone)
} else {
prj.apply plugin: libs.plugins.ltgt.errorprone.get().pluginId
dependencies {
errorprone platform(project(":platform"))
errorprone libs.google.errorprone.core
}
tasks.withType(JavaCompile) {task ->
task.dependsOn ":checkJdkInternalsExportedToGradle"
options.errorprone.disableWarningsInGeneratedCode = true
options.errorprone.errorproneArgs = [
'-XepDisableAllChecks', // only enable specific checks
'-XepAllErrorsAsWarnings', // warnings still fail build by default, but allows usage of -Pjavac.failOnWarnings=false
// List of enabled/disabled checks
// Please keep this synced with https://errorprone.info/bugpatterns when upgrading!
// Do *NOT* enable checks based on their name or description. Read the source code and make sure they are useful!
// Most error-prone checks are not useful for non-google software.
// BEGIN -- On by Default : ERROR
'-Xep:AlwaysThrows:ERROR',
// '-Xep:AndroidInjectionBeforeSuper:OFF', // we don't use android
'-Xep:ArrayEquals:ERROR',
'-Xep:ArrayFillIncompatibleType:ERROR',
'-Xep:ArrayHashCode:ERROR',
'-Xep:ArrayToString:ERROR',
'-Xep:ArraysAsListPrimitiveArray:ERROR',
'-Xep:AsyncCallableReturnsNull:ERROR',
'-Xep:AsyncFunctionReturnsNull:ERROR',
// '-Xep:AutoValueBuilderDefaultsInConstructor:OFF', // we don't use autovalue
// '-Xep:AutoValueConstructorOrderChecker:OFF', // we don't use autovalue
'-Xep:BadAnnotationImplementation:ERROR',
'-Xep:BadShiftAmount:ERROR',
'-Xep:BanJNDI:ERROR', // todo - implement with forbidden APIs instead?
'-Xep:BoxedPrimitiveEquality:ERROR',
// '-Xep:BundleDeserializationCast:OFF', // we don't use android
'-Xep:ChainingConstructorIgnoresParameter:ERROR',
'-Xep:CheckNotNullMultipleTimes:ERROR',
// '-Xep:CheckReturnValue:OFF', // we don't use these annotations
'-Xep:CollectionToArraySafeParameter:ERROR',
// '-Xep:CollectionIncompatibleType:OFF', // todo check if useful or comment why not
// '-Xep:ComparableType:OFF', // SolrTestCaseJ4.Doc and Fld are messy
'-Xep:ComparingThisWithNull:ERROR',
'-Xep:ComparisonOutOfRange:ERROR',
// '-Xep:CompatibleWithAnnotationMisuse:OFF', // we don't use this annotation
// '-Xep:CompileTimeConstant:OFF', // we don't use this annotation
'-Xep:ComputeIfAbsentAmbiguousReference:ERROR',
'-Xep:ConditionalExpressionNumericPromotion:ERROR',
'-Xep:ConstantOverflow:ERROR',
// '-Xep:DaggerProvidesNull:OFF', // we don't use dagger
'-Xep:DangerousLiteralNull:ERROR',
'-Xep:DeadException:ERROR',
'-Xep:DeadThread:ERROR',
'-Xep:DereferenceWithNullBranch:ERROR',
'-Xep:DiscardedPostfixExpression:ERROR',
// '-Xep:DoNotCall:OFF', // we don't use this annotation
'-Xep:DoNotMock:ERROR',
'-Xep:DoubleBraceInitialization:ERROR',
'-Xep:DuplicateMapKeys:ERROR',
'-Xep:DurationFrom:ERROR',
'-Xep:DurationGetTemporalUnit:ERROR',
'-Xep:DurationTemporalUnit:ERROR',
'-Xep:DurationToLongTimeUnit:ERROR',
'-Xep:EmptyTopLevelDeclaration:ERROR',
'-Xep:EqualsHashCode:ERROR',
'-Xep:EqualsNaN:ERROR',
'-Xep:EqualsNull:ERROR',
'-Xep:EqualsReference:ERROR',
'-Xep:EqualsWrongThing:ERROR',
// '-Xep:FloggerFormatString:OFF', // we don't use flogger
// '-Xep:FloggerLogString:OFF', // we don't use flogger
// '-Xep:FloggerLogVarargs:OFF', // we don't use flogger
// '-Xep:FloggerSplitLogStatement:OFF', // we don't use flogger
// '-Xep:ForOverride:OFF', // we don't use this annotation
'-Xep:FormatString:ERROR',
// '-Xep:FormatStringAnnotation:OFF', // we don't use this annotation
'-Xep:FromTemporalAccessor:ERROR',
'-Xep:FunctionalInterfaceMethodChanged:ERROR',
'-Xep:FuturesGetCheckedIllegalExceptionType:ERROR',
'-Xep:FuzzyEqualsShouldNotBeUsedInEqualsMethod:ERROR',
'-Xep:GetClassOnAnnotation:ERROR',
'-Xep:GetClassOnClass:ERROR',
// '-Xep:GuardedBy:OFF', // we don't use this annotation
// '-Xep:GuiceAssistedInjectScoping:OFF', // we don't use guice
// '-Xep:GuiceAssistedParameters:OFF', // we don't use guice
// '-Xep:GuiceInjectOnFinalField:OFF', // we don't use guice
'-Xep:HashtableContains:ERROR',
'-Xep:IdentityBinaryExpression:ERROR',
'-Xep:IdentityHashMapBoxing:ERROR',
// '-Xep:Immutable:OFF', // we don't use this annotation
// '-Xep:ImpossibleNullComparison:OFF', // we don't use protobuf
'-Xep:Incomparable:ERROR',
// '-Xep:IncompatibleArgumentType:OFF', // we don't use this annotation
// '-Xep:IncompatibleModifiers:OFF', // we don't use this annotation
'-Xep:IndexOfChar:ERROR',
'-Xep:InexactVarargsConditional:ERROR',
'-Xep:InfiniteRecursion:ERROR',
'-Xep:InjectMoreThanOneScopeAnnotationOnClass:ERROR',
'-Xep:InjectOnMemberAndConstructor:ERROR',
// '-Xep:InlineMeValidator:OFF', // we don't use this annotation
'-Xep:InstantTemporalUnit:ERROR',
'-Xep:InvalidJavaTimeConstant:ERROR',
'-Xep:InvalidPatternSyntax:ERROR',
'-Xep:InvalidTimeZoneID:ERROR',
'-Xep:InvalidZoneId:ERROR',
'-Xep:IsInstanceIncompatibleType:ERROR',
'-Xep:IsInstanceOfClass:ERROR',
// '-Xep:IsLoggableTagLength:OFF', // we don't use android
// '-Xep:JUnit3TestNotRun:OFF', // we don't use junit3
'-Xep:JUnit4ClassAnnotationNonStatic:ERROR',
// '-Xep:JUnit4SetUpNotRun:OFF', // LuceneTestCase takes care
// '-Xep:JUnit4TearDownNotRun:OFF', // LuceneTestCase takes care
// '-Xep:JUnit4TestNotRun:OFF', // RandomizedRunner finds unannotated test methods no problem
'-Xep:JUnit4TestsNotRunWithinEnclosed:ERROR',
'-Xep:JUnitAssertSameCheck:ERROR',
'-Xep:JUnitParameterMethodNotFound:ERROR',
'-Xep:JavaxInjectOnAbstractMethod:ERROR',
'-Xep:JodaToSelf:ERROR',
// '-Xep:LenientFormatStringValidation:OFF' // we don't use these google libraries
'-Xep:LiteByteStringUtf8:ERROR',
'-Xep:LocalDateTemporalAmount:ERROR',
'-Xep:LockOnBoxedPrimitive:ERROR',
'-Xep:LoopConditionChecker:ERROR',
'-Xep:LossyPrimitiveCompare:ERROR',
'-Xep:MathRoundIntLong:ERROR',
// '-Xep:MislabeledAndroidString:OFF', // we don't use android
'-Xep:MisleadingEmptyVarargs:ERROR',
'-Xep:MisleadingEscapedSpace:ERROR',
'-Xep:MisplacedScopeAnnotations:ERROR',
// '-Xep:MissingRuntimeRetention:ERROR', // todo check if useful or comment why not
// '-Xep:MissingSuperCall:OFF', // we don't use this annotation
// '-Xep:MissingTestCall:OFF', // we don't use this annotation
'-Xep:MisusedDayOfYear:ERROR',
'-Xep:MisusedWeekYear:ERROR',
'-Xep:MixedDescriptors:ERROR',
'-Xep:MockitoUsage:ERROR',
'-Xep:ModifyingCollectionWithItself:ERROR',
'-Xep:MoreThanOneInjectableConstructor:ERROR',
// '-Xep:MustBeClosedChecker:OFF', // we don't use this annotation
'-Xep:NCopiesOfChar:ERROR',
'-Xep:NoCanIgnoreReturnValueOnClasses:ERROR',
'-Xep:NonCanonicalStaticImport:ERROR',
// '-Xep:NonFinalCompileTimeConstant:OFF', // we don't use this annotation
'-Xep:NonRuntimeAnnotation:ERROR',
// '-Xep:NullArgumentForNonNullParameter:OFF', // we don't use this annotation
'-Xep:NullTernary:ERROR',
// '-Xep:NullableOnContainingClass:OFF', // we don't use this annotation
'-Xep:OptionalEquality:ERROR',
'-Xep:OptionalMapUnusedValue:ERROR',
'-Xep:OptionalOfRedundantMethod:ERROR',
'-Xep:OverlappingQualifierAndScopeAnnotation:ERROR',
'-Xep:OverridesJavaxInjectableMethod:ERROR',
'-Xep:PackageInfo:ERROR',
'-Xep:ParametersButNotParameterized:ERROR',
// '-Xep:ParcelableCreator:OFF', // we don't use android
'-Xep:PeriodFrom:ERROR',
'-Xep:PeriodGetTemporalUnit:ERROR',
'-Xep:PeriodTimeMath:ERROR',
'-Xep:PreconditionsInvalidPlaceholder:ERROR',
'-Xep:PrivateSecurityContractProtoAccess:ERROR',
'-Xep:ProtoBuilderReturnValueIgnored:ERROR',
'-Xep:ProtoStringFieldReferenceEquality:ERROR',
'-Xep:ProtoTruthMixedDescriptors:ERROR',
'-Xep:ProtocolBufferOrdinal:ERROR',
// '-Xep:ProvidesMethodOutsideOfModule:OFF', // we don't use guice
'-Xep:RandomCast:ERROR',
'-Xep:RandomModInteger:ERROR',
// '-Xep:RectIntersectReturnValueIgnored:OFF', // we don't use android
// '-Xep:RedundantSetterCall:ERROR', // todo check if useful or comment why not
// '-Xep:RequiredModifiers:OFF', // we don't use this annotation
// '-Xep:RestrictedApi:OFF', // we don't use this annotation
// '-Xep:ReturnValueIgnored:OFF', // todo there are problems that should be fixed
// '-Xep:SelfAssertion:ERROR', // todo check if useful or comment why not
'-Xep:SelfAssignment:ERROR',
'-Xep:SelfComparison:ERROR',
'-Xep:SelfEquals:ERROR',
// '-Xep:SetUnrecognized:ERROR', // todo check if useful or comment why not
// '-Xep:ShouldHaveEvenArgs:OFF', // we don't use truth
'-Xep:SizeGreaterThanOrEqualsZero:ERROR',
'-Xep:StreamToString:ERROR',
'-Xep:StringBuilderInitWithChar:ERROR',
// '-Xep:StringJoin:ERROR', // todo check if useful or comment why not
'-Xep:SubstringOfZero:ERROR',
'-Xep:SuppressWarningsDeprecated:ERROR',
'-Xep:TemporalAccessorGetChronoField:ERROR',
// '-Xep:TestParametersNotInitialized:OFF', // we don't use this annotation
// '-Xep:TheoryButNoTheories:OFF', // we don't use junit theory apis/runner
// '-Xep:ThreadBuilderNameWithPlaceholder:OFF', // todo check if useful or comment why not
// '-Xep:ThrowIfUncheckedKnownChecked:OFF', // we don't use this annotation
'-Xep:ThrowNull:ERROR',
'-Xep:TreeToString:ERROR',
'-Xep:TryFailThrowable:ERROR',
'-Xep:TypeParameterQualifier:ERROR',
'-Xep:UnicodeDirectionalityCharacters:ERROR',
'-Xep:UnicodeInCode:ERROR',
'-Xep:UnnecessaryCheckNotNull:ERROR',
'-Xep:UnnecessaryTypeArgument:ERROR',
'-Xep:UnsafeWildcard:ERROR',
'-Xep:UnusedAnonymousClass:ERROR',
'-Xep:UnusedCollectionModifiedInPlace:ERROR',
'-Xep:VarTypeName:ERROR',
'-Xep:WrongOneof:ERROR',
'-Xep:XorPower:ERROR',
'-Xep:ZoneIdOfZ:ERROR',
// END -- On by Default : ERROR
// BEGIN -- On by Default : WARNING
// '-Xep:ASTHelpersSuggestions:OFF', // we don't use ASTHelpers
// '-Xep:AddressSelection:OFF', // not relevant for Solr
// '-Xep:AlmostJavadoc:WARN', // todo check if useful or comment why not
// '-Xep:AlreadyChecked:OFF', // todo check if useful or comment why not
// '-Xep:AmbiguousMethodReference:OFF', // todo check if useful or comment why not
// '-Xep:AnnotateFormatMethod:OFF', // we don't use this annotation
// '-Xep:ArgumentSelectionDefectChecker:OFF', // todo check if useful or comment why not
'-Xep:ArrayAsKeyOfSetOrMap:WARN',
// '-Xep:ArrayRecordComponent:WARN', // records not widely used in Solr yet
'-Xep:AssertEqualsArgumentOrderChecker:WARN',
'-Xep:AssertThrowsMultipleStatements:WARN',
'-Xep:AssertionFailureIgnored:WARN',
// '-Xep:AssignmentExpression:WARN', todo: Consider this but gives lots of errors
'-Xep:AssistedInjectAndInjectOnSameConstructor:WARN',
'-Xep:AttemptedNegativeZero:WARN',
// '-Xep:AutoValueBoxedValues:WARN', // todo check if useful or comment why not
// '-Xep:AutoValueFinalMethods:OFF', // we don't use autovalue
// '-Xep:AutoValueImmutableFields:OFF', // we don't use autovalue
// '-Xep:AutoValueSubclassLeaked:OFF', // we don't use autovalue
'-Xep:BadComparable:WARN',
// '-Xep:BadImport:OFF', // style preference that we don't want to enforce
'-Xep:BadInstanceof:WARN',
'-Xep:BareDotMetacharacter:WARN',
'-Xep:BigDecimalEquals:WARN',
'-Xep:BigDecimalLiteralDouble:WARN',
// '-Xep:BooleanLiteral:WARN', // todo: Consider this - true vs Boolean.TRUE
'-Xep:BoxedPrimitiveConstructor:WARN',
// '-Xep:BugPatternNaming:OFF', // we don't use this annotation
'-Xep:ByteBufferBackingArray:WARN',
'-Xep:CacheLoaderNull:WARN',
'-Xep:CanonicalDuration:WARN',
// '-Xep:CanIgnoreReturnValueSuggester:OFF', // todo check if useful or comment why not
'-Xep:CatchAndPrintStackTrace:WARN',
// '-Xep:CatchFail:OFF', // our code is generally descriptive enough, fix case by case if tests fail
'-Xep:ChainedAssertionLosesContext:WARN',
'-Xep:CharacterGetNumericValue:WARN',
'-Xep:ClassCanBeStatic:WARN',
// '-Xep:ClassInitializationDeadlock:WARN', // todo check if useful or comment why not
'-Xep:ClassNewInstance:WARN',
// '-Xep:CloseableProvides:OFF', // we don't use this annotation
'-Xep:ClosingStandardOutputStreams:WARN',
// '-Xep:CollectionUndefinedEquality:WARN', // todo check if useful or comment why not
'-Xep:CollectorShouldNotUseState:WARN',
'-Xep:ComparableAndComparator:WARN',
'-Xep:CompareToZero:WARN',
// '-Xep:ComplexBooleanConstant:OFF', // non trivial to fix in some cases
'-Xep:DateChecker:WARN',
'-Xep:DateFormatConstant:WARN',
// '-Xep:DefaultCharset:OFF', // we have forbiddenapis for that
//'-Xep:DeeplyNested:WARN', // todo check if useful or comment why not
'-Xep:DefaultPackage:WARN',
'-Xep:DeprecatedVariable:WARN',
'-Xep:DirectInvocationOnMock:WARN',
'-Xep:DistinctVarargsChecker:WARN',
// '-Xep:DoNotCallSuggester:OFF', // we don't use this annotation
// '-Xep:DoNotClaimAnnotations:OFF', // we don't use this annotation
// '-Xep:DoNotMockAutoValue:OFF', // we don't use autovalue
// '-Xep:DoubleCheckedLocking:OFF', // todo check if useful or comment why not
// '-Xep:DuplicateBranches:WARN', // todo check if useful or comment why not
'-Xep:DuplicateDateFormatField:WARN',
// '-Xep:EffectivelyPrivate:WARN', // todo, consider this new rule
'-Xep:EmptyBlockTag:WARN',
// '-Xep:EmptyCatch:OFF', // todo check if useful or comment why not - might be handled by ECJ?
// '-Xep:EmptySetMultibindingContributions:OFF', // we don't use this annotation
// '-Xep:EnumOrdinal:WARN', // todo check if useful or comment why not
'-Xep:EqualsGetClass:WARN',
'-Xep:EqualsIncompatibleType:WARN',
'-Xep:EqualsUnsafeCast:WARN',
'-Xep:EqualsUsingHashCode:WARN',
'-Xep:ErroneousBitwiseExpression:WARN',
'-Xep:ErroneousThreadPoolConstructorChecker:WARN',
'-Xep:EscapedEntity:WARN',
// '-Xep:ExtendingJUnitAssert:OFF', // we inherit from LuceneTestCase which extends Assert
'-Xep:ExtendingJUnitAssert:WARN',
'-Xep:ExtendsObject:WARN',
'-Xep:FallThrough:WARN',
'-Xep:Finalize:WARN', // catches actual finalizers that don't call super
//'-Xep:Finally:OFF', // todo there are problems that should be fixed
'-Xep:FloatCast:WARN',
'-Xep:FloatingPointAssertionWithinEpsilon:WARN',
'-Xep:FloatingPointLiteralPrecision:WARN',
// '-Xep:FloggerArgumentToString:OFF', // we don't use flogger
// '-Xep:FloggerPerWithoutRateLimit:OFF', // we don't use flogger
// '-Xep:FloggerStringConcatenation:OFF', // we don't use flogger
// '-Xep:FragmentInjection:OFF', // we don't use android
// '-Xep:FragmentNotInstantiable:OFF', // we don't use android
// '-Xep:FutureReturnValueIgnored:OFF', // todo there are problems that should be fixed
// '-Xep:FutureTransformAsync:OFF', // not relevant for Solr codebase
'-Xep:GetClassOnEnum:WARN',
// '-Xep:GuiceNestedCombine:WARN', // todo check if useful or comment why not
'-Xep:HidingField:WARN',
'-Xep:ICCProfileGetInstance:WARN',
'-Xep:IdentityHashMapUsage:WARN',
// '-Xep:IgnoredPureGetter:OFF', // we don't use these google libraries
// '-Xep:ImmutableAnnotationChecker:OFF', // we don't use this annotation
'-Xep:ImmutableEnumChecker:WARN',
'-Xep:InconsistentCapitalization:WARN',
'-Xep:InconsistentHashCode:WARN',
'-Xep:IncorrectMainMethod:WARN',
'-Xep:IncrementInForLoopAndHeader:WARN',
'-Xep:InheritDoc:WARN',
// '-Xep:InjectInvalidTargetingOnScopingAnnotation:OFF', // we don't use this annotation
// '-Xep:InjectOnBugCheckers:OFF', // we don't use this annotation
'-Xep:InjectOnConstructorOfAbstractClass:WARN',
'-Xep:InjectScopeAnnotationOnInterfaceOrAbstractClass:WARN',
'-Xep:InjectedConstructorAnnotations:WARN',
// '-Xep:InlineFormatString:OFF', // this introduces redundancy in format strings
// '-Xep:InlineMeInliner:OFF', // we don't use this annotation
// '-Xep:InlineMeSuggester:OFF', // We don't use this annotation
// '-Xep:InputStreamSlowMultibyteRead:OFF', // todo check if useful or comment why not
'-Xep:InlineTrivialConstant:WARN',
'-Xep:InstanceOfAndCastMatchWrongType:WARN',
'-Xep:IntFloatConversion:WARN',
// '-Xep:IntLiteralCast:WARN', // todo check if useful or comment why not
'-Xep:IntLongMath:WARN',
// '-Xep:InvalidBlockTag:OFF', // this is needed for tags like lucene.internal
'-Xep:InvalidInlineTag:WARN',
'-Xep:InvalidLink:WARN',
'-Xep:InvalidParam:WARN',
// '-Xep:InvalidSnippet:WARN', // only affects ErrorProne documentation/tests
'-Xep:InvalidThrows:WARN',
'-Xep:InvalidThrowsLink:WARN',
'-Xep:IterableAndIterator:WARN',
// '-Xep:JUnit3FloatingPointComparisonWithoutDelta:OFF', // we don't use junit3
// '-Xep:JUnit4ClassUsedInJUnit3:OFF', // we don't use junit3
// '-Xep:JUnitAmbiguousTestClass:OFF', // we don't use junit3
'-Xep:JavaDurationGetSecondsGetNano:WARN',
// '-Xep:JavaDurationGetSecondsToToSeconds:WARN', // todo check if useful or comment why not
'-Xep:JavaDurationWithNanos:WARN',
'-Xep:JavaDurationWithSeconds:WARN',
'-Xep:JavaInstantGetSecondsGetNano:WARN',
'-Xep:JavaLangClash:WARN',
'-Xep:JavaLocalDateTimeGetNano:WARN',
'-Xep:JavaLocalTimeGetNano:WARN',
'-Xep:JavaPeriodGetDays:WARN',
// '-Xep:JavaTimeDefaultTimeZone:OFF', // forbidden-apis checks this
// '-Xep:JavaUtilDate:OFF', // todo check if useful or comment why not
'-Xep:JavaxInjectOnFinalField:WARN',
'-Xep:JdkObsolete:WARN',
'-Xep:JodaConstructors:WARN',
'-Xep:JodaDateTimeConstants:WARN',
'-Xep:JodaDurationWithMillis:WARN',
'-Xep:JodaInstantWithMillis:WARN',
'-Xep:JodaNewPeriod:WARN',
'-Xep:JodaPlusMinusLong:WARN',
'-Xep:JodaTimeConverterManager:WARN',
'-Xep:JodaWithDurationAddedLong:WARN',
'-Xep:JUnit4EmptyMethods:WARN',
// '-Xep:JUnitIncompatibleType:OFF', // todo check if useful or comment why not
// '-Xep:LabelledBreakTarget:OFF', // stylistic
'-Xep:LiteEnumValueOf:WARN',
'-Xep:LiteProtoToString:WARN',
'-Xep:LockNotBeforeTry:WARN',
'-Xep:LockOnNonEnclosingClassLiteral:WARN',
'-Xep:LogicalAssignment:WARN',
'-Xep:LongDoubleConversion:WARN',
'-Xep:LongFloatConversion:WARN',
'-Xep:LoopOverCharArray:WARN',
'-Xep:MalformedInlineTag:WARN',
'-Xep:MathAbsoluteNegative:WARN',
// '-Xep:MemoizeConstantVisitorStateLookups:OFF', // we don't use this class
// '-Xep:MisformattedTestData:OFF', // todo check if useful or comment why not
'-Xep:MissingCasesInEnumSwitch:WARN',
'-Xep:MissingFail:WARN',
'-Xep:MissingImplementsComparable:WARN',
'-Xep:MissingOverride:WARN',
// '-Xep:MissingRefasterAnnotation:OFF', // don't use Refaster
// '-Xep:MissingSummary:OFF', // style preference that we don't want to enforce
// '-Xep:MixedMutabilityReturnType:OFF', // todo check if useful or comment why not
'-Xep:MockIllegalThrows:WARN',
'-Xep:MockNotUsedInProduction:WARN',
// '-Xep:MockitoDoSetup:WARN', // todo check if useful or comment why not
'-Xep:ModifiedButNotUsed:WARN',
'-Xep:ModifyCollectionInEnhancedForLoop:WARN',
'-Xep:ModifySourceCollectionInStream:WARN',
'-Xep:MultimapKeys:WARN',
// '-Xep:MultipleNullnessAnnotations:WARN', // todo check if useful or comment why not
'-Xep:MultipleParallelOrSequentialCalls:WARN',
'-Xep:MultipleUnaryOperatorsInMethodCall:WARN',
// '-Xep:MutableGuiceModule:OFF', // we don't use guice
'-Xep:MutablePublicArray:WARN',
'-Xep:NamedLikeContextualKeyword:WARN',
'-Xep:NarrowCalculation:WARN',
'-Xep:NarrowingCompoundAssignment:WARN',
// '-Xep:NegativeCharLiteral:OFF', // todo check if useful or comment why not
'-Xep:NestedInstanceOfConditions:WARN',
'-Xep:NewFileSystem:WARN',
//'-Xep:NonApiType:OFF', // todo could be fixed but lots of changes
// '-Xep:NonAtomicVolatileUpdate:OFF', // todo check if useful or comment why not
'-Xep:NonCanonicalType:WARN',
'-Xep:NonOverridingEquals:WARN',
//'-Xep:NonFinalStaticField:WARN', // todo there are problems that should be fixed
// '-Xep:NotJavadoc:OFF', // we disagree; javadocs aren't purely for publishing
'-Xep:NullOptional:WARN',
// '-Xep:NullableConstructor:OFF', // we don't use this annotation
'-Xep:NullableOptional:WARN',
// '-Xep:NullablePrimitive:OFF', // we don't use this annotation
// '-Xep:NullablePrimitiveArray:OFF', // we don't use this annotation
// '-Xep:NullableTypeParameter:WARN', // todo check if useful or comment why not
// '-Xep:NullableVoid:OFF', // we don't use this annotation
// '-Xep:NullableWildcard:WARN', // todo check if useful or comment why not
'-Xep:ObjectEqualsForPrimitives:WARN',
// '-Xep:ObjectToString:OFF', // todo check if useful or comment why not
'-Xep:ObjectsHashCodePrimitive:WARN',
'-Xep:OperatorPrecedence:WARN',
'-Xep:OptionalMapToOptional:WARN',
'-Xep:OptionalNotPresent:WARN',
'-Xep:OrphanedFormatString:WARN',
// '-Xep:OutlineNone:OFF', // we don't use gwt
'-Xep:OverridingMethodInconsistentArgumentNamesChecker:WARN',
'-Xep:OverrideThrowableToString:WARN',
'-Xep:Overrides:WARN',
// '-Xep:OverridesGuiceInjectableMethod:OFF', // we don't use guice
'-Xep:ParameterName:WARN',
// '-Xep:PatternMatchingInstanceof:WARN', todo check if useful or comment why not
'-Xep:PreconditionsCheckNotNullRepeated:WARN',
'-Xep:PrimitiveAtomicReference:WARN',
'-Xep:ProtectedMembersInFinalClass:WARN',
'-Xep:ProtoDurationGetSecondsGetNano:WARN',
'-Xep:ProtoRedundantSet:WARN',
'-Xep:ProtoTimestampGetSecondsGetNano:WARN',
'-Xep:QualifierOrScopeOnInjectMethod:WARN',
'-Xep:ReachabilityFenceUsage:WARN',
// '-Xep:RedundantControlFlow:WARN', // todo check if useful or comment why not
'-Xep:ReferenceEquality:WARN',
'-Xep:RethrowReflectiveOperationExceptionAsLinkageError:WARN',
'-Xep:ReturnAtTheEndOfVoidFunction:WARN',
'-Xep:ReturnFromVoid:WARN',
'-Xep:RobolectricShadowDirectlyOn:WARN',
// '-Xep:RuleNotRun:OFF', // not relevant, we use LuceneTestCase
'-Xep:RxReturnValueIgnored:WARN',
// '-Xep:SameNameButDifferent:OFF', // todo check if useful or comment why not
'-Xep:SelfAlwaysReturnsThis:WARN',
'-Xep:SelfSet:WARN',
// '-Xep:ShortCircuitBoolean:OFF', // todo check if useful or comment why not
// '-Xep:StatementSwitchToExpressionSwitch:WARN', // todo check if useful or comment why not
// '-Xep:StaticAssignmentInConstructor:OFF', // we assign SolrTestCaseJ4.configString in many tests, difficult to untangle
'-Xep:StaticAssignmentOfThrowable:WARN',
// '-Xep:StaticGuardedByInstance:OFF', // todo check if useful or comment why not
'-Xep:StaticMockMember:WARN',
// '-Xep:StreamResourceLeak:OFF', // todo check if useful or comment why not
'-Xep:StreamToIterable:WARN',
// '-Xep:StringCaseLocaleUsage:OFF', // we have forbiddenapis for that
'-Xep:StringCharset:WARN',
// '-Xep:StringConcatToTextBlock:OFF', // not widely using text blocks yet
'-Xep:StringFormatWithLiteral:WARN',
// '-Xep:StringSplitter:OFF', // todo check if useful or comment why not - might be able to use forbidden-apis for this?
// '-Xep:SunApi:WARN', // todo check if useful or comment why not
// '-Xep:SuperCallToObjectMethod:WARN', // todo check if useful or comment why not
'-Xep:SuperEqualsIsObjectEquals:WARN',
// '-Xep:SwigMemoryLeak:OFF', // we don't use swig
// '-Xep:SynchronizeOnNonFinalField:OFF', // todo check if useful or comment why not
// '-Xep:SystemConsoleNull:WARN', // todo check if useful or comment why not
// '-Xep:ThreadJoinLoop:OFF', // todo check if useful or comment why not
// '-Xep:ThreadLocalUsage:OFF', // todo check if useful or comment why not
// '-Xep:ThreadPriorityCheck:OFF', // todo check if useful or comment why not
'-Xep:ThreeLetterTimeZoneID:WARN',
'-Xep:ThrowIfUncheckedKnownUnchecked:WARN',
'-Xep:TimeInStaticInitializer:WARN',
'-Xep:TimeUnitConversionChecker:WARN',
'-Xep:ToStringReturnsNull:WARN',
// '-Xep:TraditionalSwitchExpression:OFF', // todo check if useful or comment why not
// '-Xep:TruthAssertExpected:OFF', // we don't use truth
// '-Xep:TruthConstantAsserts:OFF', // we don't use truth
// '-Xep:TruthContainsExactlyElementsInUsage:OFF', // we don't use truth
// '-Xep:TruthGetOrDefault:OFF', // we don't use truth
// '-Xep:TruthIncompatibleType:OFF', // we don't use truth
'-Xep:TypeEquals:WARN',
'-Xep:TypeNameShadowing:WARN',
// '-Xep:TypeParameterShadowing:OFF', // todo check if useful or comment why not
// '-Xep:TypeParameterUnusedInFormals:OFF', // todo check if useful or comment why not
'-Xep:URLEqualsHashCode:WARN',
'-Xep:UndefinedEquals:WARN',
'-Xep:UnescapedEntity:WARN',
// '-Xep:UnicodeEscape:OFF', // can't enable since Lucene/Solr tests use unicode a bunch
// '-Xep:UnnecessaryAssignment:OFF', // we don't use these annotations
'-Xep:UnnecessarilyFullyQualified:WARN',
'-Xep:UnnecessaryAsync:WARN',
// '-Xep:UnnecessaryBreakInSwitch:WARN', // todo check if useful or comment why not
// '-Xep:UnnecessaryCopy:OFF', // proto-specific, not widely used
'-Xep:UnnecessaryLambda:WARN',
'-Xep:UnnecessaryLongToIntConversion:WARN',
'-Xep:UnnecessaryMethodInvocationMatcher:WARN',
'-Xep:UnnecessaryMethodReference:WARN',
// '-Xep:UnnecessaryParentheses:OFF', // style preference that we don't want to enforce
// '-Xep:UnnecessaryQualifier:OFF', // annotation-specific, not widely used
// '-Xep:UnnecessaryStringBuilder:WARN', // todo check if useful or comment why not
// '-Xep:UnnecessaryTestMethodPrefix:OFF', // style preference that we don't want to enforce
// '-Xep:UnqualifiedYield:OFF', // javac takes care
'-Xep:UnrecognisedJavadocTag:WARN',
'-Xep:UnsafeFinalization:WARN',
'-Xep:UnsafeReflectiveConstructionCast:WARN',
'-Xep:UnsynchronizedOverridesSynchronized:WARN',
'-Xep:UnusedLabel:WARN',
// '-Xep:UnusedMethod:OFF', // todo check if useful or comment why not
'-Xep:UnusedNestedClass:WARN',
'-Xep:UnusedTypeParameter:WARN',
// '-Xep:UnusedVariable:OFF', // todo check if useful or comment why not - might be able to use ecj?
// '-Xep:UseBinds:OFF', // we don't use this annotation
// '-Xep:UseCorrectAssertInTests:OFF', // we inherit from LuceneTestCase which extends Assert
'-Xep:VariableNameSameAsType:WARN',
// '-Xep:VoidUsed:WARN', // todo check if useful or comment why not
// '-Xep:WaitNotInLoop:OFF', // todo check if useful or comment why not
// '-Xep:WakelockReleasedDangerously:OFF', // we don't use android
// '-Xep:WithSignatureDiscouraged:OFF', // we aren't using this error-prone internal api
// END -- On by Default : WARNING
// BEGIN -- Experimental: ERROR
'-Xep:BanClassLoader:ERROR',
// END -- Experimental: ERROR
// BEGIN -- Experimental: WARNING
// '-Xep:DefaultLocale:WARN', // todo check if useful or comment why not
// '-Xep:NegativeBoolean:OFF', // todo check if useful or comment why not
// END -- Experimental: WARNING
// BEGIN -- Experimental: SUGGESTION
// '-Xep:AddNullMarkedToPackageInfo:OFF', // todo check if useful or comment why not
// END -- Experimental: SUGGESTION
]
}
}
}
}
// Exclude generated OpenAPI sources and the vendored noggit JSON parser (org.noggit, not our
// code/conventions) in solrj from Error Prone checks.
configure(project(":solr:solrj")) {
plugins.withId(libs.plugins.ltgt.errorprone.get().pluginId) {
tasks.withType(JavaCompile) {
options.errorprone.excludedPaths = ".*/build/generated/.*|.*/org/noggit/.*"
}
}
}
// Exclude JavaCC-generated parser sources in solr:core from Error Prone checks.
configure(project(":solr:core")) {
plugins.withId(libs.plugins.ltgt.errorprone.get().pluginId) {
tasks.withType(JavaCompile) {
options.errorprone.excludedPaths = ".*/org/apache/solr/parser/.*"
}
}
}
// Exclude vendored Tika sources (copied in to eliminate the Tika dependency) in
// solr:modules:extraction from Error Prone checks.
configure(project(":solr:modules:extraction")) {
plugins.withId(libs.plugins.ltgt.errorprone.get().pluginId) {
tasks.withType(JavaCompile) {
options.errorprone.excludedPaths = ".*/org/apache/solr/handler/extraction/fromtika/.*"
}
}
}