| # |
| # 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. |
| # |
| |
| # Contains bug patterns up to Error Prone 2.15.0 |
| |
| #################################################################################################### |
| # On by default : ERROR |
| # See https://errorprone.info/bugpatterns |
| #################################################################################################### |
| |
| #AlwaysThrows=ERROR |
| # Detects calls that will fail at runtime |
| |
| #AndroidInjectionBeforeSuper=ERROR |
| # AndroidInjection.inject() should always be invoked before calling super.lifecycleMethod() |
| |
| #ArrayEquals=ERROR |
| # Reference equality used to compare arrays |
| |
| #ArrayFillIncompatibleType=ERROR |
| # Arrays.fill(Object[], Object) called with incompatible types. |
| |
| #ArrayHashCode=ERROR |
| # hashcode method on array does not hash array contents |
| |
| #ArrayToString=ERROR |
| # Calling toString on an array does not provide useful information |
| |
| #ArraysAsListPrimitiveArray=ERROR |
| # Arrays.asList does not autobox primitive arrays, as one might expect. |
| |
| #AsyncCallableReturnsNull=ERROR |
| # AsyncCallable should not return a null Future, only a Future whose result is null. |
| |
| #AsyncFunctionReturnsNull=ERROR |
| # AsyncFunction should not return a null Future, only a Future whose result is null. |
| |
| #AutoValueBuilderDefaultsInConstructor=ERROR |
| # Defaults for AutoValue Builders should be set in the factory method returning Builder instances, not the constructor |
| |
| #AutoValueConstructorOrderChecker=ERROR |
| # Arguments to AutoValue constructor are in the wrong order |
| |
| #BadAnnotationImplementation=ERROR |
| # Classes that implement Annotation must override equals and hashCode. Consider using AutoAnnotation instead of implementing Annotation by hand. |
| |
| #BadShiftAmount=ERROR |
| # Shift by an amount that is out of range |
| |
| #BanJNDI=ERROR |
| # Using JNDI may deserialize user input via the `Serializable` API which is extremely dangerous |
| |
| #BoxedPrimitiveEquality=ERROR |
| # Comparison using reference equality instead of value equality. Reference equality of boxed primitive types is usually not useful, as they are value objects, and it is bug-prone, as instances are cached for some values but not others. |
| |
| #BundleDeserializationCast=ERROR |
| # Object serialized in Bundle may have been flattened to base type. |
| |
| #ChainingConstructorIgnoresParameter=ERROR |
| # The called constructor accepts a parameter with the same name and type as one of its caller's parameters, but its caller doesn't pass that parameter to it. It's likely that it was intended to. |
| |
| #CheckNotNullMultipleTimes=ERROR |
| # A variable was checkNotNulled multiple times. Did you mean to check something else? |
| |
| #CheckReturnValue=ERROR |
| # Ignored return value of method that is annotated with @CheckReturnValue |
| |
| #CollectionIncompatibleType=ERROR |
| # Incompatible type as argument to Object-accepting Java collections method |
| |
| #CollectionToArraySafeParameter=ERROR |
| # The type of the array parameter of Collection.toArray needs to be compatible with the array type |
| |
| #ComparableType=ERROR |
| # Implementing 'Comparable<T>' where T is not the same as the implementing class is incorrect, since it violates the symmetry contract of compareTo. |
| |
| #ComparingThisWithNull=ERROR |
| # this == null is always false, this != null is always true |
| |
| #ComparisonOutOfRange=ERROR |
| # Comparison to value that is out of range for the compared type |
| |
| #CompatibleWithAnnotationMisuse=ERROR |
| # @CompatibleWith's value is not a type argument. |
| |
| #CompileTimeConstant=ERROR |
| # Non-compile-time constant expression passed to parameter with @CompileTimeConstant type annotation. |
| |
| #ComputeIfAbsentAmbiguousReference=ERROR |
| # computeIfAbsent passes the map key to the provided class's constructor |
| |
| #ConditionalExpressionNumericPromotion=ERROR |
| # A conditional expression with numeric operands of differing types will perform binary numeric promotion of the operands; when these operands are of reference types, the expression's result may not be of the expected type. |
| |
| #ConstantOverflow=ERROR |
| # Compile-time constant expression overflows |
| |
| #DaggerProvidesNull=ERROR |
| # Dagger @Provides methods may not return null unless annotated with @Nullable |
| |
| #DangerousLiteralNull=ERROR |
| # This method is null-hostile: passing a null literal to it is always wrong |
| |
| #DeadException=ERROR |
| # Exception created but not thrown |
| |
| #DeadThread=ERROR |
| # Thread created but not started |
| |
| #DiscardedPostfixExpression=ERROR |
| # The result of this unary operation on a lambda parameter is discarded |
| |
| #DoNotCall=ERROR |
| # This method should not be called. |
| |
| #DoNotMock=ERROR |
| # Identifies undesirable mocks. |
| |
| #DoubleBraceInitialization=ERROR |
| # Prefer collection factory methods or builders to the double-brace initialization pattern. |
| |
| #DuplicateMapKeys=ERROR |
| # Map#ofEntries will throw an IllegalArgumentException if there are any duplicate keys |
| |
| #DurationFrom=ERROR |
| # Duration.from(Duration) returns itself; from(Period) throws a runtime exception. |
| |
| #DurationGetTemporalUnit=ERROR |
| # Duration.get() only works with SECONDS or NANOS. |
| |
| #DurationTemporalUnit=ERROR |
| # Duration APIs only work for DAYS or exact durations. |
| |
| #DurationToLongTimeUnit=ERROR |
| # Unit mismatch when decomposing a Duration or Instant to call a <long, TimeUnit> API |
| |
| #EmptyTopLevelDeclaration=ERROR |
| # Empty top-level type declarations should be omitted |
| |
| #EqualsHashCode=ERROR |
| # Classes that override equals should also override hashCode. |
| |
| #EqualsNaN=ERROR |
| # == NaN always returns false; use the isNaN methods instead |
| |
| #EqualsNull=ERROR |
| # The contract of Object.equals() states that for any non-null reference value x, x.equals(null) should return false. If x is null, a NullPointerException is thrown. Consider replacing equals() with the == operator. |
| |
| #EqualsReference=ERROR |
| # == must be used in equals method to check equality to itself or an infinite loop will occur. |
| |
| #EqualsWrongThing=ERROR |
| # Comparing different pairs of fields/getters in an equals implementation is probably a mistake. |
| |
| #FloggerFormatString=ERROR |
| # Invalid printf-style format string |
| |
| #FloggerLogString=ERROR |
| # Arguments to log(String) must be compile-time constants or parameters annotated with @CompileTimeConstant. If possible, use Flogger's formatting log methods instead. |
| |
| #FloggerLogVarargs=ERROR |
| # logVarargs should be used to pass through format strings and arguments. |
| |
| #FloggerSplitLogStatement=ERROR |
| # Splitting log statements and using Api instances directly breaks logging. |
| |
| #ForOverride=ERROR |
| # Method annotated @ForOverride must be protected or package-private and only invoked from declaring class, or from an override of the method |
| |
| #FormatString=ERROR |
| # Invalid printf-style format string |
| |
| #FormatStringAnnotation=ERROR |
| # Invalid format string passed to formatting method. |
| |
| #FromTemporalAccessor=ERROR |
| # Certain combinations of javaTimeType.from(TemporalAccessor) will always throw a DateTimeException or return the parameter directly. |
| |
| #FunctionalInterfaceMethodChanged=ERROR |
| # Casting a lambda to this @FunctionalInterface can cause a behavior change from casting to a functional superinterface, which is surprising to users. Prefer decorator methods to this surprising behavior. |
| |
| #FuturesGetCheckedIllegalExceptionType=ERROR |
| # Futures.getChecked requires a checked exception type with a standard constructor. |
| |
| #FuzzyEqualsShouldNotBeUsedInEqualsMethod=ERROR |
| # DoubleMath.fuzzyEquals should never be used in an Object.equals() method |
| |
| #GetClassOnAnnotation=ERROR |
| # Calling getClass() on an annotation may return a proxy class |
| |
| #GetClassOnClass=ERROR |
| # Calling getClass() on an object of type Class returns the Class object for java.lang.Class; you probably meant to operate on the object directly |
| |
| #GuardedBy=ERROR |
| # Checks for unguarded accesses to fields and methods with @GuardedBy annotations |
| |
| #GuiceAssistedInjectScoping=ERROR |
| # Scope annotation on implementation class of AssistedInject factory is not allowed |
| |
| #GuiceAssistedParameters=ERROR |
| # A constructor cannot have two @Assisted parameters of the same type unless they are disambiguated with named @Assisted annotations. |
| |
| #GuiceInjectOnFinalField=ERROR |
| # Although Guice allows injecting final fields, doing so is disallowed because the injected value may not be visible to other threads. |
| |
| #HashtableContains=ERROR |
| # contains() is a legacy method that is equivalent to containsValue() |
| |
| #IdentityBinaryExpression=ERROR |
| # A binary expression where both operands are the same is usually incorrect. |
| |
| #IdentityHashMapBoxing=ERROR |
| # Using IdentityHashMap with a boxed type as the key is risky since boxing may produce distinct instances |
| |
| #IgnoredPureGetter=ERROR |
| # Getters on AutoValues, AutoBuilders, and Protobuf Messages are side-effect free, so there is no point in calling them if the return value is ignored. While there are no side effects from the getter, the receiver may have side effects. |
| |
| #Immutable=ERROR |
| # Type declaration annotated with @Immutable is not immutable |
| |
| #Incomparable=ERROR |
| # Types contained in sorted collections must implement Comparable. |
| |
| #IncompatibleArgumentType=ERROR |
| # Passing argument to a generic method with an incompatible type. |
| |
| #IncompatibleModifiers=ERROR |
| # This annotation has incompatible modifiers as specified by its @IncompatibleModifiers annotation |
| |
| #IndexOfChar=ERROR |
| # The first argument to indexOf is a Unicode code point, and the second is the index to start the search from |
| |
| #InexactVarargsConditional=ERROR |
| # Conditional expression in varargs call contains array and non-array arguments |
| |
| #InfiniteRecursion=ERROR |
| # This method always recurses, and will cause a StackOverflowError |
| |
| #InjectMoreThanOneScopeAnnotationOnClass=ERROR |
| # A class can be annotated with at most one scope annotation. |
| |
| #InjectOnMemberAndConstructor=ERROR |
| # Members shouldn't be annotated with @Inject if constructor is already annotated @Inject |
| |
| #InlineMeValidator=ERROR |
| # Ensures that the @InlineMe annotation is used correctly. |
| |
| #InstantTemporalUnit=ERROR |
| # Instant APIs only work for NANOS, MICROS, MILLIS, SECONDS, MINUTES, HOURS, HALF_DAYS and DAYS. |
| |
| #InvalidJavaTimeConstant=ERROR |
| # This checker errors on calls to java.time methods using values that are guaranteed to throw a DateTimeException. |
| |
| #InvalidPatternSyntax=ERROR |
| # Invalid syntax used for a regular expression |
| |
| #InvalidTimeZoneID=ERROR |
| # Invalid time zone identifier. TimeZone.getTimeZone(String) will silently return GMT instead of the time zone you intended. |
| |
| #InvalidZoneId=ERROR |
| # Invalid zone identifier. ZoneId.of(String) will throw exception at runtime. |
| |
| #IsInstanceIncompatibleType=ERROR |
| # This use of isInstance will always evaluate to false. |
| |
| #IsInstanceOfClass=ERROR |
| # The argument to Class#isInstance(Object) should not be a Class |
| |
| #IsLoggableTagLength=ERROR |
| # Log tag too long, cannot exceed 23 characters. |
| |
| #JUnit3TestNotRun=ERROR |
| # Test method will not be run; please correct method signature (Should be public, non-static, and method name should begin with "test"). |
| |
| #JUnit4ClassAnnotationNonStatic=ERROR |
| # This method should be static |
| |
| #JUnit4SetUpNotRun=ERROR |
| # setUp() method will not be run; please add JUnit's @Before annotation |
| |
| #JUnit4TearDownNotRun=ERROR |
| # tearDown() method will not be run; please add JUnit's @After annotation |
| |
| #JUnit4TestNotRun=ERROR |
| # This looks like a test method but is not run; please add @Test and @Ignore, or, if this is a helper method, reduce its visibility. |
| |
| #JUnit4TestsNotRunWithinEnclosed=ERROR |
| # This test is annotated @Test, but given it's within a class using the Enclosed runner, will not run. |
| |
| #JUnitAssertSameCheck=ERROR |
| # An object is tested for reference equality to itself using JUnit library. |
| |
| #JUnitParameterMethodNotFound=ERROR |
| # The method for providing parameters was not found. |
| |
| #JavaxInjectOnAbstractMethod=ERROR |
| # Abstract and default methods are not injectable with javax.inject.Inject |
| |
| #JodaToSelf=ERROR |
| # Use of Joda-Time's DateTime.toDateTime(), Duration.toDuration(), Instant.toInstant(), Interval.toInterval(), and Period.toPeriod() are not allowed. |
| |
| #LiteByteStringUtf8=ERROR |
| # This pattern will silently corrupt certain byte sequences from the serialized protocol message. Use ByteString or byte[] directly |
| |
| #LocalDateTemporalAmount=ERROR |
| # LocalDate.plus() and minus() does not work with Durations. LocalDate represents civil time (years/months/days), so java.time.Period is the appropriate thing to add or subtract instead. |
| |
| #LockOnBoxedPrimitive=ERROR |
| # It is dangerous to use a boxed primitive as a lock as it can unintentionally lead to sharing a lock with another piece of code. |
| |
| #LoopConditionChecker=ERROR |
| # Loop condition is never modified in loop body. |
| |
| #LossyPrimitiveCompare=ERROR |
| # Using an unnecessarily-wide comparison method can lead to lossy comparison |
| |
| #MathRoundIntLong=ERROR |
| # Math.round(Integer) results in truncation |
| |
| #MislabeledAndroidString=ERROR |
| # Certain resources in `android.R.string` have names that do not match their content |
| |
| #MisplacedScopeAnnotations=ERROR |
| # Scope annotations used as qualifier annotations don't have any effect. Move the scope annotation to the binding location or delete it. |
| |
| #MissingSuperCall=ERROR |
| # Overriding method is missing a call to overridden super method |
| |
| #MissingTestCall=ERROR |
| # A terminating method call is required for a test helper to have any effect. |
| |
| #MisusedDayOfYear=ERROR |
| # Use of 'DD' (day of year) in a date pattern with 'MM' (month of year) is not likely to be intentional, as it would lead to dates like 'March 73rd'. |
| |
| #MisusedWeekYear=ERROR |
| # Use of "YYYY" (week year) in a date pattern without "ww" (week in year). You probably meant to use "yyyy" (year) instead. |
| |
| #MixedDescriptors=ERROR |
| # The field number passed into #getFieldByNumber belongs to a different proto to the Descriptor. |
| |
| #MockitoUsage=ERROR |
| # Missing method call for verify(mock) here |
| |
| #ModifyingCollectionWithItself=ERROR |
| # Using a collection function with itself as the argument. |
| |
| #MoreThanOneInjectableConstructor=ERROR |
| # This class has more than one @Inject-annotated constructor. Please remove the @Inject annotation from all but one of them. |
| |
| MustBeClosedChecker=ERROR |
| # This method returns a resource which must be managed carefully, not just left for garbage collection. If it is a constant that will persist for the lifetime of your program, move it to a private static final field. Otherwise, you should use it in a try-with-resources. |
| |
| #NCopiesOfChar=ERROR |
| # The first argument to nCopies is the number of copies, and the second is the item to copy |
| |
| #NoCanIgnoreReturnValueOnClasses=ERROR |
| # @CanIgnoreReturnValue should not be applied to classes as it almost always overmatches (as it |
| # applies to constructors and all methods), and the CIRVness isn't conferred to its subclasses. |
| |
| #NonCanonicalStaticImport=ERROR |
| # Static import of type uses non-canonical name |
| |
| #NonFinalCompileTimeConstant=ERROR |
| # @CompileTimeConstant parameters should be final or effectively final |
| |
| #NonRuntimeAnnotation=ERROR |
| # Calling getAnnotation on an annotation that is not retained at runtime. |
| |
| #NullArgumentForNonNullParameter=ERROR |
| # Null is not permitted for this parameter. |
| |
| #NullTernary=ERROR |
| # This conditional expression may evaluate to null, which will result in an NPE when the result is unboxed. |
| |
| #OptionalEquality=ERROR |
| # Comparison using reference equality instead of value equality |
| |
| #OptionalMapUnusedValue=ERROR |
| # Optional.ifPresent is preferred over Optional.map when the return value is unused |
| |
| #OptionalOfRedundantMethod=ERROR |
| # Optional.of() always returns a non-empty optional. Using ifPresent/isPresent/orElse/orElseGet/orElseThrow/isPresent/or/orNull method on it is unnecessary and most probably a bug. |
| |
| #OverlappingQualifierAndScopeAnnotation=ERROR |
| # Annotations cannot be both Scope annotations and Qualifier annotations: this causes confusion when trying to use them. |
| |
| #OverridesJavaxInjectableMethod=ERROR |
| # This method is not annotated with @Inject, but it overrides a method that is annotated with @javax.inject.Inject. The method will not be Injected. |
| |
| #PackageInfo=ERROR |
| # Declaring types inside package-info.java files is very bad form |
| |
| #ParametersButNotParameterized=ERROR |
| # This test has @Parameters but is using the default JUnit4 runner. The parameters will have no effect. |
| |
| #ParcelableCreator=ERROR |
| # Detects classes which implement Parcelable but don't have CREATOR |
| |
| #PeriodFrom=ERROR |
| # Period.from(Period) returns itself; from(Duration) throws a runtime exception. |
| |
| #PeriodGetTemporalUnit=ERROR |
| # Period.get() only works with YEARS, MONTHS, or DAYS. |
| |
| #PeriodTimeMath=ERROR |
| # When adding or subtracting from a Period, Duration is incompatible. |
| |
| #PreconditionsInvalidPlaceholder=ERROR |
| # Preconditions only accepts the %s placeholder in error message strings |
| |
| #PrivateSecurityContractProtoAccess=ERROR |
| # Access to a private protocol buffer field is forbidden. This protocol buffer carries a security contract, and can only be created using an approved library. Direct access to the fields is forbidden. |
| |
| #ProtoBuilderReturnValueIgnored=ERROR |
| # Unnecessary call to proto's #build() method. If you don't consume the return value of #build(), the result is discarded and the only effect is to verify that all required fields are set, which can be expressed more directly with #isInitialized(). |
| |
| #ProtoFieldNullComparison=ERROR |
| # Protobuf fields cannot be null. |
| |
| #ProtoStringFieldReferenceEquality=ERROR |
| # Comparing protobuf fields of type String using reference equality |
| |
| #ProtoTruthMixedDescriptors=ERROR |
| # The arguments passed to `ignoringFields` are inconsistent with the proto which is the subject of the assertion. |
| |
| #ProtocolBufferOrdinal=ERROR |
| # To get the tag number of a protocol buffer enum, use getNumber() instead. |
| |
| #ProvidesMethodOutsideOfModule=ERROR |
| # @Provides methods need to be declared in a Module to have any effect. |
| |
| #RandomCast=ERROR |
| # Casting a random number in the range [0.0, 1.0) to an integer or long always results in 0. |
| |
| #RandomModInteger=ERROR |
| # Use Random.nextInt(int). Random.nextInt() % n can have negative results |
| |
| #RectIntersectReturnValueIgnored=ERROR |
| # Return value of android.graphics.Rect.intersect() must be checked |
| |
| #RequiredModifiers=ERROR |
| # This annotation is missing required modifiers as specified by its @RequiredModifiers annotation |
| |
| #RestrictedApiChecker=ERROR |
| # Check for non-allowlisted callers to RestrictedApiChecker. |
| |
| #ReturnValueIgnored=ERROR |
| # Return value of this method must be used |
| |
| #SelfAssignment=ERROR |
| # Variable assigned to itself |
| |
| #SelfComparison=ERROR |
| # An object is compared to itself |
| |
| #SelfEquals=ERROR |
| # Testing an object for equality with itself will always be true. |
| |
| #ShouldHaveEvenArgs=ERROR |
| # This method must be called with an even number of arguments. |
| |
| #SizeGreaterThanOrEqualsZero=ERROR |
| # Comparison of a size >= 0 is always true, did you intend to check for non-emptiness? |
| |
| #StreamToString=ERROR |
| # Calling toString on a Stream does not provide useful information |
| |
| #StringBuilderInitWithChar=ERROR |
| # StringBuilder does not have a char constructor; this invokes the int constructor. |
| |
| #SubstringOfZero=ERROR |
| # String.substring(0) returns the original String |
| |
| #SuppressWarningsDeprecated=ERROR |
| # Suppressing "deprecated" is probably a typo for "deprecation" |
| |
| #TemporalAccessorGetChronoField=ERROR |
| # TemporalAccessor.get() only works for certain values of ChronoField. |
| |
| #TestParametersNotInitialized=ERROR |
| # This test has @TestParameter fields but is using the default JUnit4 runner. The parameters will not be initialised beyond their default value. |
| |
| #TheoryButNoTheories=ERROR |
| # This test has members annotated with @Theory, @DataPoint, or @DataPoints but is using the default JUnit4 runner. |
| |
| #ThrowIfUncheckedKnownChecked=ERROR |
| # throwIfUnchecked(knownCheckedException) is a no-op. |
| |
| #ThrowNull=ERROR |
| # Throwing 'null' always results in a NullPointerException being thrown. |
| |
| #TreeToString=ERROR |
| # Tree#toString shouldn't be used for Trees deriving from the code being compiled, as it discards whitespace and comments. |
| |
| #TruthSelfEquals=ERROR |
| # isEqualTo should not be used to test an object for equality with itself; the assertion will never fail. |
| |
| #TryFailThrowable=ERROR |
| # Catching Throwable/Error masks failures from fail() or assert*() in the try block |
| |
| #TypeParameterQualifier=ERROR |
| # Type parameter used as type qualifier |
| |
| #UnicodeDirectionalityCharacters=ERROR |
| # Unicode directionality modifiers can be used to conceal code in many editors. |
| |
| UnicodeInCode=OFF |
| # Avoid using non-ASCII Unicode characters outside of comments and literals, as they can be confusing. |
| |
| #UnnecessaryCheckNotNull=ERROR |
| # This null check is unnecessary; the expression can never be null |
| |
| #UnnecessaryTypeArgument=ERROR |
| # Non-generic methods should not be invoked with type arguments |
| |
| #UnsafeWildcard=ERROR |
| # Certain wildcard types can confuse the compiler. |
| |
| #UnusedAnonymousClass=ERROR |
| # Instance created but never used |
| |
| #UnusedCollectionModifiedInPlace=ERROR |
| # Collection is modified in place, but the result is not used |
| |
| #VarTypeName=ERROR |
| # `var` should not be used as a type name. |
| |
| #WrongOneof=ERROR |
| # This field is guaranteed not to be set given it's within a switch over a one_of. |
| |
| #XorPower=ERROR |
| # The `^` operator is binary XOR, not a power operator. |
| |
| #ZoneIdOfZ=ERROR |
| # Use ZoneOffset.UTC instead of ZoneId.of("Z"). |
| |
| #################################################################################################### |
| # On by default : WARNING |
| # See https://errorprone.info/bugpatterns |
| #################################################################################################### |
| |
| #AlmostJavadoc=WARN |
| # This comment contains Javadoc or HTML tags, but isn't started with a double asterisk (/**); is it meant to be Javadoc? |
| |
| #AlreadyChecked=WARN |
| # This condition has already been checked. |
| |
| #AmbiguousMethodReference=WARN |
| # Method reference is ambiguous |
| |
| AnnotateFormatMethod=ERROR |
| # This method passes a pair of parameters through to String.format, but the enclosing method wasn't annotated @FormatMethod. Doing so gives compile-time rather than run-time protection against malformed format strings. |
| |
| #ArgumentSelectionDefectChecker=WARN |
| # Arguments are in the wrong order or could be commented for clarity. |
| |
| ArrayAsKeyOfSetOrMap=ERROR |
| # Arrays do not override equals() or hashCode, so comparisons will be done on reference equality only. If neither deduplication nor lookup are needed, consider using a List instead. Otherwise, use IdentityHashMap/Set, a Map from a library that handles object arrays, or an Iterable/List of pairs. |
| |
| AssertEqualsArgumentOrderChecker=ERROR |
| # Arguments are swapped in assertEquals-like call |
| |
| AssertThrowsMultipleStatements=ERROR |
| # The lambda passed to assertThrows should contain exactly one statement |
| |
| AssertionFailureIgnored=ERROR |
| # This assertion throws an AssertionError if it fails, which will be caught by an enclosing try block. |
| |
| #AssistedInjectAndInjectOnSameConstructor=WARN |
| # @AssistedInject and @Inject cannot be used on the same constructor. |
| |
| #AutoValueFinalMethods=WARN |
| # Make toString(), hashCode() and equals() final in AutoValue classes, so it is clear to readers that AutoValue is not overriding them |
| |
| #AutoValueImmutableFields=WARN |
| # AutoValue recommends using immutable collections |
| |
| #AutoValueSubclassLeaked=WARN |
| # Do not refer to the autogenerated AutoValue_ class outside the file containing the corresponding @AutoValue base class. |
| |
| #BadComparable=WARN |
| # Possible sign flip from narrowing conversion |
| |
| BadImport=ERROR |
| # Importing nested classes/static methods/static fields with commonly-used names can make code harder to read, because it may not be clear from the context exactly which type is being referred to. Qualifying the name with that of the containing class can make the code clearer. |
| |
| BadInstanceof=ERROR |
| # instanceof used in a way that is equivalent to a null check. |
| |
| BareDotMetacharacter=ERROR |
| # "." is rarely useful as a regex, as it matches any character. To match a literal '.' character, instead write "\.". |
| |
| BigDecimalEquals=ERROR |
| # BigDecimal#equals has surprising behavior: it also compares scale. |
| |
| BigDecimalLiteralDouble=ERROR |
| # new BigDecimal(double) loses precision in this case. |
| |
| BoxedPrimitiveConstructor=ERROR |
| # valueOf or autoboxing provides better time and space performance |
| |
| #BugPatternNaming=WARN |
| # Giving BugPatterns a name different to the enclosing class can be confusing |
| |
| #BuilderReturnThis=WARN |
| # Builder instance method does not return 'this' |
| |
| ByteBufferBackingArray=ERROR |
| # ByteBuffer.array() shouldn't be called unless ByteBuffer.arrayOffset() is used or if the ByteBuffer was initialized using ByteBuffer.wrap() or ByteBuffer.allocate(). |
| |
| #CacheLoaderNull=WARN |
| # The result of CacheLoader#load must be non-null. |
| |
| CanIgnoreReturnValueSuggester=OFF |
| # Methods that always 'return this' should be annotated with @CanIgnoreReturnValue |
| |
| #CannotMockFinalClass=WARN |
| # Mockito cannot mock final classes |
| |
| #CanonicalDuration=WARN |
| # Duration can be expressed more clearly with different units |
| |
| CatchAndPrintStackTrace=ERROR |
| # Logging or rethrowing exceptions should usually be preferred to catching and calling printStackTrace |
| |
| #CatchFail=WARN |
| # Ignoring exceptions and calling fail() is unnecessary, and makes test output less useful |
| |
| #ChainedAssertionLosesContext=WARN |
| # Inside a Subject, use check(…) instead of assert*() to preserve user-supplied messages and other settings. |
| |
| #CharacterGetNumericValue=WARN |
| # getNumericValue has unexpected behaviour: it interprets A-Z as base-36 digits with values 10-35, but also supports non-arabic numerals and miscellaneous numeric unicode characters like ㊷; consider using Character.digit or UCharacter.getUnicodeNumericValue instead |
| |
| #ClassCanBeStatic=WARN |
| # Inner class is non-static but does not reference enclosing class |
| |
| ClassNewInstance=ERROR |
| # Class.newInstance() bypasses exception checking; prefer getDeclaredConstructor().newInstance() |
| |
| #CloseableProvides=WARN |
| # Providing Closeable resources makes their lifecycle unclear |
| |
| #CollectionUndefinedEquality=WARN |
| # This type does not have well-defined equals behavior. |
| |
| #CollectorShouldNotUseState=WARN |
| # Collector.of() should not use state |
| |
| #ComparableAndComparator=WARN |
| # Class should not implement both `Comparable` and `Comparator` |
| |
| #CompareToZero=WARN |
| # The result of #compareTo or #compare should only be compared to 0. It is an implementation detail whether a given type returns strictly the values {-1, 0, +1} or others. |
| |
| #ComplexBooleanConstant=WARN |
| # Non-trivial compile time constant boolean expressions shouldn't be used. |
| |
| #DateChecker=WARN |
| # Warns against suspect looking calls to java.util.Date APIs |
| |
| DateFormatConstant=ERROR |
| # DateFormat is not thread-safe, and should not be used as a constant field. |
| |
| DefaultCharset=ERROR |
| # Implicit use of the platform default charset, which can result in differing behaviour between JVM executions or incorrect behavior if the encoding of the data source doesn't match expectations. |
| |
| #DefaultPackage=WARN |
| # Java classes shouldn't use default package |
| |
| #DeprecatedVariable=WARN |
| # Applying the @Deprecated annotation to local variables or parameters has no effect |
| |
| #DirectInvocationOnMock=WARN |
| # Methods should not be directly invoked on mocks. Should this be part of a verify(..) call? |
| |
| DistinctVarargsChecker=ERROR |
| # Method expects distinct arguments at some/all positions |
| |
| #DoNotCallSuggester=WARN |
| # Consider annotating methods that always throw with @DoNotCall. Read more at https://errorprone.info/bugpattern/DoNotCall |
| |
| #DoNotClaimAnnotations=WARN |
| # Don't 'claim' annotations in annotation processors; Processor#process should unconditionally return `false` |
| |
| #DoNotMockAutoValue=WARN |
| # AutoValue classes represent pure data classes, so mocking them should not be necessary. Construct a real instance of the class instead. |
| |
| DoubleCheckedLocking=ERROR |
| # Double-checked locking on non-volatile fields is unsafe |
| |
| #EmptyBlockTag=WARN |
| # A block tag (@param, @return, @throws, @deprecated) has an empty description. Block tags without descriptions don't add much value for future readers of the code; consider removing the tag entirely or adding a description. |
| |
| #EmptyCatch=WARN |
| # Caught exceptions should not be ignored |
| |
| #EmptySetMultibindingContributions=WARN |
| # @Multibinds is a more efficient and declarative mechanism for ensuring that a set multibinding is present in the graph. |
| |
| EqualsGetClass=ERROR |
| # Prefer instanceof to getClass when implementing Object#equals. |
| |
| EqualsIncompatibleType=ERROR |
| # An equality test between objects with incompatible types always returns false |
| |
| EqualsUnsafeCast=ERROR |
| # The contract of #equals states that it should return false for incompatible types, while this implementation may throw ClassCastException. |
| |
| EqualsUsingHashCode=ERROR |
| # Implementing #equals by just comparing hashCodes is fragile. Hashes collide frequently, and this will lead to false positives in #equals. |
| |
| ErroneousBitwiseExpression=ERROR |
| # This expression evaluates to 0. If this isn't an error, consider expressing it as a literal 0. |
| |
| ErroneousThreadPoolConstructorChecker=ERROR |
| # Thread pool size will never go beyond corePoolSize if an unbounded queue is used |
| |
| EscapedEntity=ERROR |
| # HTML entities in @code/@literal tags will appear literally in the rendered javadoc. |
| |
| #ExtendingJUnitAssert=WARN |
| # When only using JUnit Assert's static methods, you should import statically instead of extending. |
| |
| #ExtendsObject=WARN |
| # `T extends Object` is redundant (unless you are using the Checker Framework). |
| |
| #FallThrough=WARN |
| # Switch case may fall through |
| |
| #Finally=WARN |
| # If you return or throw from a finally, then values returned or thrown from the try-catch block will be ignored. Consider using try-with-resources instead. |
| |
| FloatCast=ERROR |
| # Use parentheses to make the precedence explicit |
| |
| FloatingPointAssertionWithinEpsilon=ERROR |
| # This fuzzy equality check is using a tolerance less than the gap to the next number. You may want a less restrictive tolerance, or to assert equality. |
| |
| FloatingPointLiteralPrecision=ERROR |
| # Floating point literal loses precision |
| |
| #FloggerArgumentToString=WARN |
| # Use Flogger's printf-style formatting instead of explicitly converting arguments to strings |
| |
| #FloggerStringConcatenation=WARN |
| # Prefer string formatting using printf placeholders (e.g. %s) instead of string concatenation |
| |
| #FragmentInjection=WARN |
| # Classes extending PreferenceActivity must implement isValidFragment such that it does not unconditionally return true to prevent vulnerability to fragment injection attacks. |
| |
| #FragmentNotInstantiable=WARN |
| # Subclasses of Fragment must be instantiable via Class#newInstance(): the class must be public, static and have a public nullary constructor |
| |
| FutureReturnValueIgnored=ERROR |
| # Return value of methods returning Future must be checked. Ignoring returned Futures suppresses exceptions thrown from the code that completes the Future. |
| |
| GetClassOnEnum=ERROR |
| # Calling getClass() on an enum may return a subclass of the enum type |
| |
| #HidingField=WARN |
| # Hiding fields of superclasses may cause confusion and errors |
| |
| #IdentityHashMapUsage=WARN |
| # IdentityHashMap usage shouldn't be intermingled with Map |
| |
| #ImmutableAnnotationChecker=WARN |
| # Annotations should always be immutable |
| |
| #ImmutableEnumChecker=WARN |
| # Enums should always be immutable |
| |
| #InconsistentCapitalization=WARN |
| # It is confusing to have a field and a parameter under the same scope that differ only in capitalization. |
| |
| InconsistentHashCode=ERROR |
| # Including fields in hashCode which are not compared in equals violates the contract of hashCode. |
| |
| #IncorrectMainMethod=WARN |
| # 'main' methods must be public, static, and void |
| |
| #IncrementInForLoopAndHeader=WARN |
| # This for loop increments the same variable in the header and in the body |
| |
| #InheritDoc=WARN |
| # Invalid use of @inheritDoc. |
| |
| #InjectInvalidTargetingOnScopingAnnotation=WARN |
| # A scoping annotation's Target should include TYPE and METHOD. |
| |
| #InjectOnConstructorOfAbstractClass=WARN |
| # Constructors on abstract classes are never directly @Inject'ed, only the constructors of their subclasses can be @Inject'ed. |
| |
| #InjectScopeAnnotationOnInterfaceOrAbstractClass=WARN |
| # Scope annotation on an interface or abstract class is not allowed |
| |
| #InjectedConstructorAnnotations=WARN |
| # Injected constructors cannot be optional nor have binding annotations |
| |
| #InlineFormatString=WARN |
| # Prefer to create format strings inline, instead of extracting them to a single-use constant |
| |
| #InlineMeInliner=WARN |
| # Callers of this API should be inlined. |
| |
| #InlineMeSuggester=WARN |
| # This deprecated API looks inlineable. If you'd like the body of the API to be inlined to its callers, please annotate it with @InlineMe. |
| |
| #InputStreamSlowMultibyteRead=WARN |
| # Please also override int read(byte[], int, int), otherwise multi-byte reads from this input stream are likely to be slow. |
| |
| #InstanceOfAndCastMatchWrongType=WARN |
| # Casting inside an if block should be plausibly consistent with the instanceof type |
| |
| IntLongMath=ERROR |
| # Expression of type int may overflow before being assigned to a long |
| |
| #InvalidBlockTag=WARN |
| # This tag is invalid. |
| |
| #InvalidInlineTag=WARN |
| # This tag is invalid. |
| |
| #InvalidLink=WARN |
| # This @link tag looks wrong. |
| |
| #InvalidParam=WARN |
| # This @param tag doesn't refer to a parameter of the method. |
| |
| #InvalidThrows=WARN |
| # The documented method doesn't actually throw this checked exception. |
| |
| #InvalidThrowsLink=WARN |
| # Javadoc links to exceptions in @throws without a @link tag (@throws Exception, not @throws {@link Exception}). |
| |
| #IterableAndIterator=WARN |
| # Class should not implement both `Iterable` and `Iterator` |
| |
| #JUnit3FloatingPointComparisonWithoutDelta=WARN |
| # Floating-point comparison without error tolerance |
| |
| #JUnit4ClassUsedInJUnit3=WARN |
| # Some JUnit4 construct cannot be used in a JUnit3 context. Convert your class to JUnit4 style to use them. |
| |
| #JUnitAmbiguousTestClass=WARN |
| # Test class inherits from JUnit 3's TestCase but has JUnit 4 @Test or @RunWith annotations. |
| |
| #JavaDurationGetSecondsGetNano=WARN |
| # duration.getNano() only accesses the underlying nanosecond adjustment from the whole second. |
| |
| #JavaDurationWithNanos=WARN |
| # Use of java.time.Duration.withNanos(int) is not allowed. |
| |
| #JavaDurationWithSeconds=WARN |
| # Use of java.time.Duration.withSeconds(long) is not allowed. |
| |
| #JavaInstantGetSecondsGetNano=WARN |
| # instant.getNano() only accesses the underlying nanosecond adjustment from the whole second. |
| |
| JavaLangClash=ERROR |
| # Never reuse class names from java.lang |
| |
| #JavaLocalDateTimeGetNano=WARN |
| # localDateTime.getNano() only accesss the nanos-of-second field. It's rare to only use getNano() without a nearby getSecond() call. |
| |
| #JavaLocalTimeGetNano=WARN |
| # localTime.getNano() only accesses the nanos-of-second field. It's rare to only use getNano() without a nearby getSecond() call. |
| |
| #JavaPeriodGetDays=WARN |
| # period.getDays() only accesses the "days" portion of the Period, and doesn't represent the total span of time of the period. Consider using org.threeten.extra.Days to extract the difference between two civil dates if you want the whole time. |
| |
| #JavaTimeDefaultTimeZone=WARN |
| # java.time APIs that silently use the default system time-zone are not allowed. |
| |
| #JavaUtilDate=WARN |
| # Date has a bad API that leads to bugs; prefer java.time.Instant or LocalDate. |
| |
| #JavaxInjectOnFinalField=WARN |
| # @javax.inject.Inject cannot be put on a final field. |
| |
| JdkObsolete=ERROR |
| # Suggests alternatives to obsolete JDK classes. |
| |
| #JodaConstructors=WARN |
| # Use of certain JodaTime constructors are not allowed. |
| |
| #JodaDateTimeConstants=WARN |
| # Using the `PER` constants in `DateTimeConstants` is problematic because they encourage manual date/time math. |
| |
| #JodaDurationWithMillis=WARN |
| # Use of duration.withMillis(long) is not allowed. Please use Duration.millis(long) instead. |
| |
| #JodaInstantWithMillis=WARN |
| # Use of instant.withMillis(long) is not allowed. Please use new Instant(long) instead. |
| |
| #JodaNewPeriod=WARN |
| # This may have surprising semantics, e.g. new Period(LocalDate.parse("1970-01-01"), LocalDate.parse("1970-02-02")).getDays() == 1, not 32. |
| |
| #JodaPlusMinusLong=WARN |
| # Use of JodaTime's type.plus(long) or type.minus(long) is not allowed (where <type> = {Duration,Instant,DateTime,DateMidnight}). Please use type.plus(Duration.millis(long)) or type.minus(Duration.millis(long)) instead. |
| |
| #JodaTimeConverterManager=WARN |
| # Joda-Time's ConverterManager makes the semantics of DateTime/Instant/etc construction subject to global static state. If you need to define your own converters, use a helper. |
| |
| #JodaWithDurationAddedLong=WARN |
| # Use of JodaTime's type.withDurationAdded(long, int) (where <type> = {Duration,Instant,DateTime}). Please use type.withDurationAdded(Duration.millis(long), int) instead. |
| |
| #LiteEnumValueOf=WARN |
| # Instead of converting enums to string and back, its numeric value should be used instead as it is the stable part of the protocol defined by the enum. |
| |
| #LiteProtoToString=WARN |
| # toString() on lite protos will not generate a useful representation of the proto from optimized builds. Consider whether using some subset of fields instead would provide useful information. |
| |
| LockNotBeforeTry=ERROR |
| # Calls to Lock#lock should be immediately followed by a try block which releases the lock. |
| |
| #LogicalAssignment=WARN |
| # Assignment where a boolean expression was expected; use == if this assignment wasn't expected or add parentheses for clarity. |
| |
| LongDoubleConversion=ERROR |
| # Conversion from long to double may lose precision; use an explicit cast to double if this was intentional |
| |
| LongFloatConversion=ERROR |
| # Conversion from long to float may lose precision; use an explicit cast to float if this was intentional |
| |
| #LoopOverCharArray=WARN |
| # toCharArray allocates a new array, using charAt is more efficient |
| |
| #MalformedInlineTag=WARN |
| # This Javadoc tag is malformed. The correct syntax is {@tag and not @{tag. |
| |
| #MathAbsoluteRandom=WARN |
| # Math.abs does not always give a positive result. Please consider other methods for positive random numbers. |
| |
| #MemoizeConstantVisitorStateLookups=WARN |
| # Anytime you need to look up a constant value from VisitorState, improve performance by creating a cache for it with VisitorState.memoize |
| |
| #MissingCasesInEnumSwitch=WARN |
| # Switches on enum types should either handle all values, or have a default case. |
| |
| #MissingFail=WARN |
| # Not calling fail() when expecting an exception masks bugs |
| |
| #MissingImplementsComparable=WARN |
| # Classes implementing valid compareTo function should implement Comparable interface |
| |
| MissingOverride=ERROR |
| # method overrides method in supertype; expected @Override |
| |
| #MissingSummary=WARN |
| # A summary line is required on public/protected Javadocs. |
| |
| #MixedMutabilityReturnType=WARN |
| # This method returns both mutable and immutable collections or maps from different paths. This may be confusing for users of the method. |
| |
| #ModifiedButNotUsed=WARN |
| # A collection or proto builder was created, but its values were never accessed. |
| |
| #MockNotUsedInProduction=WARN |
| # This mock is instantiated and configured, but is never passed to production code. It should be |
| # either removed or used. |
| |
| #ModifyCollectionInEnhancedForLoop=WARN |
| # Modifying a collection while iterating over it in a loop may cause a ConcurrentModificationException to be thrown or lead to undefined behavior. |
| |
| #ModifySourceCollectionInStream=WARN |
| # Modifying the backing source during stream operations may cause unintended results. |
| |
| #MultipleParallelOrSequentialCalls=WARN |
| # Multiple calls to either parallel or sequential are unnecessary and cause confusion. |
| |
| #MultipleUnaryOperatorsInMethodCall=WARN |
| # Avoid having multiple unary operators acting on the same variable in a method call |
| |
| #MutablePublicArray=WARN |
| # Non-empty arrays are mutable, so this `public static final` array is not a constant and can be modified by clients of this class. Prefer an ImmutableList, or provide an accessor method that returns a defensive copy. |
| |
| #NarrowCalculation=WARN |
| # This calculation may lose precision compared to its target type. |
| |
| #NarrowingCompoundAssignment=WARN |
| # Compound assignments may hide dangerous casts |
| |
| #NegativeCharLiteral=WARN |
| # Casting a negative signed literal to an (unsigned) char might be misleading. |
| |
| #NestedInstanceOfConditions=WARN |
| # Nested instanceOf conditions of disjoint types create blocks of code that never execute |
| |
| #NonAtomicVolatileUpdate=WARN |
| # This update of a volatile variable is non-atomic |
| |
| #NonCanonicalType=WARN |
| # This type is referred to by a non-canonical name, which may be misleading. |
| |
| #NonOverridingEquals=WARN |
| # equals method doesn't override Object.equals |
| |
| #NullOptional=WARN |
| # Passing a literal null to an Optional parameter is almost certainly a mistake. Did you mean to provide an empty Optional? |
| |
| #NullableConstructor=WARN |
| # Constructors should not be annotated with @Nullable since they cannot return null |
| |
| #NullablePrimitive=WARN |
| # @Nullable should not be used for primitive types since they cannot be null |
| |
| #NullablePrimitiveArray=WARN |
| # @Nullable type annotations should not be used for primitive types since they cannot be null |
| |
| #NullableVoid=WARN |
| # void-returning methods should not be annotated with @Nullable, since they cannot return null |
| |
| ObjectEqualsForPrimitives=ERROR |
| # Avoid unnecessary boxing by using plain == for primitive types. |
| |
| #ObjectToString=WARN |
| # Calling toString on Objects that don't override toString() doesn't provide useful information |
| |
| #ObjectsHashCodePrimitive=WARN |
| # Objects.hashCode(Object o) should not be passed a primitive value |
| |
| OperatorPrecedence=ERROR |
| # Use grouping parenthesis to make the operator precedence explicit |
| |
| #OptionalMapToOptional=WARN |
| # Mapping to another Optional will yield a nested Optional. Did you mean flatMap? |
| |
| #OptionalNotPresent=WARN |
| # This Optional has been confirmed to be empty at this point, so the call to `get` will throw. |
| |
| OrphanedFormatString=ERROR |
| # String literal contains format specifiers, but is not passed to a format method |
| |
| #OutlineNone=WARN |
| # Setting CSS outline style to none or 0 (while not otherwise providing visual focus indicators) is inaccessible for users navigating a web page without a mouse. |
| |
| #OverrideThrowableToString=WARN |
| # To return a custom message with a Throwable class, one should override getMessage() instead of toString(). |
| |
| Overrides=ERROR |
| # Varargs doesn't agree for overridden method |
| |
| #OverridesGuiceInjectableMethod=WARN |
| # This method is not annotated with @Inject, but it overrides a method that is annotated with @com.google.inject.Inject. Guice will inject this method, and it is recommended to annotate it explicitly. |
| |
| #ParameterName=WARN |
| # Detects `/* name= */`-style comments on actual parameters where the name doesn't match the formal parameter |
| |
| #PreconditionsCheckNotNullRepeated=WARN |
| # Including the first argument of checkNotNull in the failure message is not useful, as it will always be `null`. |
| |
| #PrimitiveAtomicReference=WARN |
| # Using compareAndSet with boxed primitives is dangerous, as reference rather than value equality is used. Consider using AtomicInteger, AtomicLong, AtomicBoolean from JDK or AtomicDouble from Guava instead. |
| |
| #ProtectedMembersInFinalClass=WARN |
| # Protected members in final classes can be package-private |
| |
| #ProtoDurationGetSecondsGetNano=WARN |
| # getNanos() only accesses the underlying nanosecond-adjustment of the duration. |
| |
| #ProtoRedundantSet=WARN |
| # A field on a protocol buffer was set twice in the same chained expression. |
| |
| #ProtoTimestampGetSecondsGetNano=WARN |
| # getNanos() only accesses the underlying nanosecond-adjustment of the instant. |
| |
| #QualifierOrScopeOnInjectMethod=WARN |
| # Qualifiers/Scope annotations on @Inject methods don't have any effect. Move the qualifier annotation to the binding location. |
| |
| #ReachabilityFenceUsage=WARN |
| # reachabilityFence should always be called inside a finally block |
| |
| #ReferenceEquality=WARN |
| # Comparison using reference equality instead of value equality |
| |
| #RethrowReflectiveOperationExceptionAsLinkageError=WARN |
| # Prefer LinkageError for rethrowing ReflectiveOperationException as unchecked |
| |
| #ReturnFromVoid=WARN |
| # Void methods should not have a @return tag. |
| |
| #RobolectricShadowDirectlyOn=WARN |
| # Migrate off a deprecated overload of org.robolectric.shadow.api.Shadow#directlyOn |
| |
| #RxReturnValueIgnored=WARN |
| # Returned Rx objects must be checked. Ignoring a returned Rx value means it is never scheduled for execution |
| |
| #SameNameButDifferent=WARN |
| # This type name shadows another in a way that may be confusing. |
| |
| #SelfAlwaysReturnsThis=WARN |
| # Non-abstract instance methods named 'self()' that return the enclosing class must always 'return this'. |
| |
| #ShortCircuitBoolean=WARN |
| # Prefer the short-circuiting boolean operators && and || to & and |. |
| |
| StaticAssignmentInConstructor=ERROR |
| # This assignment is to a static field. Mutating static state from a constructor is highly error-prone. |
| |
| #StaticAssignmentOfThrowable=WARN |
| # Saving instances of Throwable in static fields is discouraged, prefer to create them on-demand when an exception is thrown |
| |
| #StaticGuardedByInstance=WARN |
| # Writes to static fields should not be guarded by instance locks |
| |
| #StaticMockMember=WARN |
| # @Mock members of test classes shouldn't share state between tests and preferably be non-static |
| |
| #StreamResourceLeak=WARN |
| # Streams that encapsulate a closeable resource should be closed using try-with-resources |
| |
| StreamToIterable=ERROR |
| # Using stream::iterator creates a one-shot Iterable, which may cause surprising failures. |
| |
| #StringSplitter=WARN |
| # String.split(String) has surprising behavior |
| |
| #SwigMemoryLeak=WARN |
| # SWIG generated code that can't call a C++ destructor will leak memory |
| |
| SynchronizeOnNonFinalField=ERROR |
| # Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects. |
| |
| #ThreadJoinLoop=WARN |
| # Thread.join needs to be immediately surrounded by a loop until it succeeds. Consider using Uninterruptibles.joinUninterruptibly. |
| |
| ThreadLocalUsage=ERROR |
| # ThreadLocals should be stored in static fields |
| |
| #ThreadPriorityCheck=WARN |
| # Relying on the thread scheduler is discouraged. |
| |
| #ThreeLetterTimeZoneID=WARN |
| # Three-letter time zone identifiers are deprecated, may be ambiguous, and might not do what you intend; the full IANA time zone ID should be used instead. |
| |
| #TimeUnitConversionChecker=WARN |
| # This TimeUnit conversion looks buggy: converting from a smaller unit to a larger unit (and passing a constant), converting to/from the same TimeUnit, or converting TimeUnits where the result is statically known to be 0 or 1 are all buggy patterns. |
| |
| #ToStringReturnsNull=WARN |
| # An implementation of Object.toString() should never return null. |
| |
| #TruthAssertExpected=WARN |
| # The actual and expected values appear to be swapped, which results in poor assertion failure messages. The actual value should come first. |
| |
| #TruthConstantAsserts=WARN |
| # Truth Library assert is called on a constant. |
| |
| #TruthGetOrDefault=WARN |
| # Asserting on getOrDefault is unclear; prefer containsEntry or doesNotContainKey |
| |
| #TruthIncompatibleType=WARN |
| # Argument is not compatible with the subject's type. |
| |
| #TypeEquals=WARN |
| # com.sun.tools.javac.code.Type doesn't override Object.equals and instances are not interned by javac, so testing types for equality should be done with Types#isSameType instead |
| |
| #TypeNameShadowing=WARN |
| # Type parameter declaration shadows another named type |
| |
| #TypeParameterShadowing=WARN |
| # Type parameter declaration overrides another type parameter already declared |
| |
| #TypeParameterUnusedInFormals=WARN |
| # Declaring a type parameter that is only used in the return type is a misuse of generics: operations on the type parameter are unchecked, it hides unsafe casts at invocations of the method, and it interacts badly with method overload resolution. |
| |
| URLEqualsHashCode=ERROR |
| # Avoid hash-based containers of java.net.URL–the containers rely on equals() and hashCode(), which cause java.net.URL to make blocking internet connections. |
| |
| #UndefinedEquals=WARN |
| # This type is not guaranteed to implement a useful #equals method. |
| |
| #UnescapedEntity=WARN |
| # Javadoc is interpreted as HTML, so HTML entities such as &, <, > must be escaped. If this finding seems wrong (e.g. is within a @code or @literal tag), check whether the tag could be malformed and not recognised by the compiler. |
| |
| #UnicodeEscape=WARN |
| # Using unicode escape sequences for printable ASCII characters is obfuscated, and potentially dangerous. |
| |
| #UnnecessaryAssignment=WARN |
| # Fields annotated with @Inject/@Mock should not be manually assigned to, as they should be initialized by a framework. Remove the assignment if a framework is being used, or the annotation if one isn't. |
| |
| UnnecessaryLambda=ERROR |
| # Returning a lambda from a helper method or saving it in a constant is unnecessary; prefer to implement the functional interface method directly and use a method reference instead. |
| |
| #UnnecessaryLongToIntConversion=WARN |
| # Converting a long or Long to an int to pass as a long parameter is usually not necessary. If this conversion is intentional, consider `Longs.constrainToRange()` instead. |
| |
| #UnnecessaryMethodInvocationMatcher=WARN |
| # It is not necessary to wrap a MethodMatcher with methodInvocation(). |
| |
| #UnnecessaryMethodReference=WARN |
| # This method reference is unnecessary, and can be replaced with the variable itself. |
| |
| #UnnecessaryParentheses=WARN |
| # These grouping parentheses are unnecessary; it is unlikely the code will be misinterpreted without them |
| |
| #UnrecognisedJavadocTag=WARN |
| # This Javadoc tag wasn't recognised by the parser. Is it malformed somehow, perhaps with mismatched braces? |
| |
| #UnsafeFinalization=WARN |
| # Finalizer may run before native code finishes execution |
| |
| #UnsafeReflectiveConstructionCast=WARN |
| # Prefer `asSubclass` instead of casting the result of `newInstance`, to detect classes of incorrect type before invoking their constructors.This way, if the class is of the incorrect type,it will throw an exception before invoking its constructor. |
| |
| #UnsynchronizedOverridesSynchronized=WARN |
| # Unsynchronized method overrides a synchronized method. |
| |
| UnusedMethod=ERROR |
| # Unused. |
| |
| #UnusedNestedClass=WARN |
| # This nested class is unused, and can be removed. |
| |
| #UnusedTypeParameter=WARN |
| # This type parameter is unused and can be removed. |
| |
| #UnusedVariable=WARN |
| # Unused. |
| |
| #UseBinds=WARN |
| # @Binds is a more efficient and declarative mechanism for delegating a binding. |
| |
| UseCorrectAssertInTests=ERROR |
| # Java assert is used in test. For testing purposes Assert.* matchers should be used. |
| |
| #VariableNameSameAsType=WARN |
| # variableName and type with the same name would refer to the static field instead of the class |
| |
| #WaitNotInLoop=WARN |
| # Because of spurious wakeups, Object.wait() and Condition.await() must always be called in a loop |
| |
| #WakelockReleasedDangerously=WARN |
| # A wakelock acquired with a timeout may be released by the system before calling `release`, even after checking `isHeld()`. If so, it will throw a RuntimeException. Please wrap in a try/catch block. |
| |
| #WithSignatureDiscouraged=WARN |
| # withSignature is discouraged. Prefer .named and/or .withParameters where possible. |
| |
| #################################################################################################### |
| # Experimental : ERROR |
| # See https://errorprone.info/bugpatterns |
| #################################################################################################### |
| |
| #AndroidJdkLibsChecker=ERROR |
| # Use of class, field, or method that is not compatible with legacy Android devices |
| |
| #AutoFactoryAtInject=ERROR |
| # @AutoFactory and @Inject should not be used in the same type. |
| |
| #BanSerializableRead=ERROR |
| # Deserializing user input via the `Serializable` API is extremely dangerous |
| |
| #ClassName=ERROR |
| # The source file name should match the name of the top-level class it contains |
| |
| #ComparisonContractViolated=ERROR |
| # This comparison method violates the contract |
| |
| #DeduplicateConstants=ERROR |
| # This expression was previously declared as a constant; consider replacing this occurrence. |
| |
| #DepAnn=ERROR |
| # Item documented with a @deprecated javadoc note is not annotated with @Deprecated |
| |
| #EmptyIf=ERROR |
| # Empty statement after if |
| |
| #ExtendsAutoValue=ERROR |
| # Do not extend an @AutoValue/@AutoOneOf class in non-generated code. |
| |
| #InjectMoreThanOneQualifier=ERROR |
| # Using more than one qualifier annotation on the same element is not allowed. |
| |
| #InjectScopeOrQualifierAnnotationRetention=ERROR |
| # Scoping and qualifier annotations must have runtime retention. |
| |
| #InsecureCryptoUsage=ERROR |
| # A standard cryptographic operation is used in a mode that is prone to vulnerabilities |
| |
| #IterablePathParameter=ERROR |
| # Path implements Iterable<Path>; prefer Collection<Path> for clarity |
| |
| #Java7ApiChecker=ERROR |
| # Use of class, field, or method that is not compatible with JDK 7 |
| |
| #Java8ApiChecker=ERROR |
| # Use of class, field, or method that is not compatible with JDK 8 |
| |
| #LockMethodChecker=ERROR |
| # This method does not acquire the locks specified by its @LockMethod annotation |
| |
| #LongLiteralLowerCaseSuffix=ERROR |
| # Prefer 'L' to 'l' for the suffix to long literals |
| |
| #NoAllocation=ERROR |
| # @NoAllocation was specified on this method, but something was found that would trigger an allocation |
| |
| #RefersToDaggerCodegen=ERROR |
| # Don't refer to Dagger's internal or generated code |
| |
| #StaticOrDefaultInterfaceMethod=ERROR |
| # Static and default interface methods are not natively supported on older Android devices. |
| |
| #StaticQualifiedUsingExpression=ERROR |
| # A static variable or method should be qualified with a class name, not expression |
| |
| #UnlockMethod=ERROR |
| # This method does not acquire the locks specified by its @UnlockMethod annotation |
| |
| #################################################################################################### |
| # Experimental : WARNING |
| # See https://errorprone.info/bugpatterns |
| #################################################################################################### |
| |
| #AnnotationPosition=WARN |
| # Annotations should be positioned after Javadocs, but before modifiers. |
| |
| #AssertFalse=WARN |
| # Assertions may be disabled at runtime and do not guarantee that execution will halt here; consider throwing an exception instead |
| |
| #AssistedInjectAndInjectOnConstructors=WARN |
| # @AssistedInject and @Inject should not be used on different constructors in the same class. |
| |
| #BinderIdentityRestoredDangerously=WARN |
| # A call to Binder.clearCallingIdentity() should be followed by Binder.restoreCallingIdentity() in a finally block. Otherwise the wrong Binder identity may be used by subsequent code. |
| |
| #BindingToUnqualifiedCommonType=WARN |
| # This code declares a binding for a common value type without a Qualifier annotation. |
| |
| #CannotMockFinalClass=WARN |
| # Mockito cannot mock final classes |
| |
| #CatchingUnchecked=WARN |
| # This catch block catches `Exception`, but can only catch unchecked exceptions. Consider catching RuntimeException (or something more specific) instead so it is more apparent that no checked exceptions are being handled. |
| |
| #CheckedExceptionNotThrown=WARN |
| # This method cannot throw a checked exception that it claims to. This may cause consumers of the API to incorrectly attempt to handle, or propagate, this exception. |
| |
| ConstantPatternCompile=WARN |
| # Variables initialized with Pattern#compile calls on constants can be constants |
| |
| #DifferentNameButSame=WARN |
| # This type is referred to in different ways within this file, which may be confusing. |
| |
| #EqualsBrokenForNull=WARN |
| # equals() implementation may throw NullPointerException when given null |
| |
| #ExpectedExceptionChecker=WARN |
| # Prefer assertThrows to ExpectedException |
| |
| #FloggerLogWithCause=WARN |
| # Setting the caught exception as the cause of the log message may provide more context for anyone debugging errors. |
| |
| #FloggerMessageFormat=WARN |
| # Invalid message format-style format specifier ({0}), expected printf-style (%s) |
| |
| #FloggerPassedAround=WARN |
| # There is no advantage to passing around a logger rather than declaring one in the class that needs it. |
| |
| #FloggerRedundantIsEnabled=WARN |
| # Logger level check is already implied in the log() call. An explicit atLevel.isEnabled() check is redundant. |
| |
| #FloggerRequiredModifiers=WARN |
| # FluentLogger.forEnclosingClass should always be saved to a private static final field. |
| |
| #FloggerWithCause=WARN |
| # Calling withCause(Throwable) with an inline allocated Throwable is discouraged. Consider using withStackTrace(StackSize) instead, and specifying a reduced stack size (e.g. SMALL, MEDIUM or LARGE) instead of FULL, to improve performance. |
| |
| #FloggerWithoutCause=WARN |
| # Use withCause to associate Exceptions with log statements |
| |
| #FunctionalInterfaceClash=WARN |
| # Overloads will be ambiguous when passing lambda arguments. |
| |
| #HardCodedSdCardPath=WARN |
| # Hardcoded reference to /sdcard |
| |
| #InconsistentOverloads=WARN |
| # The ordering of parameters in overloaded methods should be as consistent as possible (when viewed from left to right) |
| |
| #InitializeInline=WARN |
| # Initializing variables in their declaring statement is clearer, where possible. |
| |
| #InterfaceWithOnlyStatics=WARN |
| # This interface only contains static fields and methods; consider making it a final class instead to prevent subclassing. |
| |
| #InterruptedExceptionSwallowed=WARN |
| # This catch block appears to be catching an explicitly declared InterruptedException as an Exception/Throwable and not handling the interruption separately. |
| |
| #MemberName=WARN |
| # Methods and non-static variables should be named in lowerCamelCase. |
| |
| #MissingDefault=WARN |
| # The Google Java Style Guide requires that each switch statement includes a default statement group, even if it contains no code. (This requirement is lifted for any switch statement that covers all values of an enum.) |
| |
| #NonCanonicalStaticMemberImport=WARN |
| # Static import of member uses non-canonical name |
| |
| #PreferJavaTimeOverload=WARN |
| # Prefer using java.time-based APIs when available. Note that this checker does not and cannot guarantee that the overloads have equivalent semantics, but that is generally the case with overloaded methods. |
| |
| #PreferredInterfaceType=WARN |
| # This type can be more specific. |
| |
| PrimitiveArrayPassedToVarargsMethod=WARN |
| # Passing a primitive array to a varargs method is usually wrong |
| |
| #QualifierWithTypeUse=WARN |
| # Injection frameworks currently don't understand Qualifiers in TYPE_PARAMETER or TYPE_USE contexts. |
| |
| RedundantOverride=ERROR |
| # This overriding method is redundant, and can be removed. |
| |
| RedundantThrows=ERROR |
| # Thrown exception is a subtype of another |
| |
| StronglyTypeByteString=WARN |
| # This primitive byte array is only used to construct ByteStrings. It would be clearer to strongly type the field instead. |
| |
| StronglyTypeTime=WARN |
| # This primitive integral type is only used to construct time types. It would be clearer to strongly type the field instead. |
| |
| #SuppressWarningsWithoutExplanation=WARN |
| # Use of @SuppressWarnings should be accompanied by a comment describing why the warning is safe to ignore. |
| |
| #SystemExitOutsideMain=WARN |
| # Code that contains System.exit() is untestable. |
| |
| #SystemOut=WARN |
| # Printing to standard output should only be used for debugging, not in production code |
| |
| #TestExceptionChecker=WARN |
| # Using @Test(expected=…) is discouraged, since the test will pass if any statement in the test method throws the expected exception |
| |
| #ThrowSpecificExceptions=WARN |
| # Base exception classes should be treated as abstract. If the exception is intended to be caught, throw a domain-specific exception. Otherwise, prefer a more specific exception for clarity. Common alternatives include: AssertionError, IllegalArgumentException, IllegalStateException, and (Guava's) VerifyException. |
| |
| #TimeUnitMismatch=WARN |
| # An value that appears to be represented in one unit is used where another appears to be required (e.g., seconds where nanos are needed) |
| |
| #TooManyParameters=WARN |
| # A large number of parameters on public APIs should be avoided. |
| |
| #TransientMisuse=WARN |
| # Static fields are implicitly transient, so the explicit modifier is unnecessary |
| |
| #TryWithResourcesVariable=WARN |
| # This variable is unnecessary, the try-with-resources resource can be a reference to a final or effectively final variable |
| |
| #UnnecessarilyFullyQualified=WARN |
| # This fully qualified name is unambiguous to the compiler if imported. |
| |
| #UnnecessarilyVisible=WARN |
| # Some methods (such as those annotated with @Inject or @Provides) are only intended to be called by a framework, and so should have default visibility. |
| |
| #UnnecessaryAnonymousClass=WARN |
| # Implementing a functional interface is unnecessary; prefer to implement the functional interface method directly and use a method reference instead. |
| |
| #UnnecessaryDefaultInEnumSwitch=WARN |
| # Switch handles all enum values: an explicit default case is unnecessary and defeats error checking for non-exhaustive switches. |
| |
| #UnnecessaryFinal=WARN |
| # Since Java 8, it's been unnecessary to make local variables and parameters `final` for use in lambdas or anonymous classes. Marking them as `final` is weakly discouraged, as it adds a fair amount of noise for minimal benefit. |
| |
| #UnnecessaryOptionalGet=WARN |
| # This code can be simplified by directly using the lambda parameters instead of calling get..() on optional. |
| |
| #UnsafeLocaleUsage=WARN |
| # Possible unsafe operation related to the java.util.Locale library. |
| |
| #UnusedException=WARN |
| # This catch block catches an exception and re-throws another, but swallows the caught exception rather than setting it as a cause. This can make debugging harder. |
| |
| #UrlInSee=WARN |
| # URLs should not be used in @see tags; they are designed for Java elements which could be used with @link. |
| |
| #UsingJsr305CheckReturnValue=WARN |
| # Prefer ErrorProne's @CheckReturnValue over JSR305's version. |
| |
| #Var=WARN |
| # Non-constant variable missing @Var annotation |
| |
| #Varifier=WARN |
| # Consider using `var` here to avoid boilerplate. |
| |
| #################################################################################################### |
| # Experimental : SUGGESTION |
| # See https://errorprone.info/bugpatterns |
| #################################################################################################### |
| |
| #AnnotationMirrorToString=WARN |
| # AnnotationMirror#toString doesn't use fully qualified type names, prefer auto-common's AnnotationMirrors#toString |
| |
| #AnnotationValueToString=WARN |
| # AnnotationValue#toString doesn't use fully qualified type names, prefer auto-common's AnnotationValues#toString |
| |
| #BooleanParameter=WARN |
| # Use parameter comments to document ambiguous literals |
| |
| #ClassNamedLikeTypeParameter=WARN |
| # This class's name looks like a Type Parameter. |
| |
| #ConstantField=WARN |
| # Fields with CONSTANT_CASE names should be both static and final |
| |
| #EqualsMissingNullable=WARN |
| # Method overrides Object.equals but does not have @Nullable on its parameter |
| |
| #FieldCanBeFinal=WARN |
| # This field is only assigned during initialization; consider making it final |
| |
| #FieldCanBeLocal=WARN |
| # This field can be replaced with a local variable in the methods that use it. |
| |
| #FieldCanBeStatic=WARN |
| # A final field initialized at compile-time with an instance of an immutable type can be static. |
| |
| #FieldMissingNullable=WARN |
| # Field is assigned (or compared against) a definitely null value but is not annotated @Nullable |
| |
| #ForEachIterable=WARN |
| # This loop can be replaced with an enhanced for loop. |
| |
| #ImmutableMemberCollection=WARN |
| # If you don't intend to mutate a member collection prefer using Immutable types. |
| |
| #ImmutableRefactoring=WARN |
| # Refactors uses of the JSR 305 @Immutable to Error Prone's annotation |
| |
| #ImmutableSetForContains=WARN |
| # This private static ImmutableList is only used for contains, containsAll or isEmpty checks; prefer ImmutableSet. |
| |
| #ImplementAssertionWithChaining=WARN |
| # Prefer check(…), which usually generates more readable failure messages. |
| |
| #LambdaFunctionalInterface=WARN |
| # Use Java's utility functional interfaces instead of Function<A, B> for primitive types. |
| |
| #MethodCanBeStatic=WARN |
| # A private method that does not reference the enclosing instance can be static |
| |
| #MissingBraces=WARN |
| # The Google Java Style Guide requires braces to be used with if, else, for, do and while statements, even when the body is empty or contains only a single statement. |
| |
| #MixedArrayDimensions=WARN |
| # C-style array declarations should not be used |
| |
| #MultiVariableDeclaration=WARN |
| # Variable declarations should declare only one variable |
| |
| #MultipleTopLevelClasses=WARN |
| # Source files should not contain multiple top-level class declarations |
| |
| #PackageLocation=WARN |
| # Package names should match the directory they are declared in |
| |
| #ParameterComment=WARN |
| # Non-standard parameter comment; prefer `/* paramName= */ arg` |
| |
| #ParameterMissingNullable=WARN |
| # Parameter has handling for null but is not annotated @Nullable |
| |
| #PrivateConstructorForNoninstantiableModule=WARN |
| # Add a private constructor to modules that will not be instantiated by Dagger. |
| |
| #PrivateConstructorForUtilityClass=WARN |
| # Classes which are not intended to be instantiated should be made non-instantiable with a private constructor. This includes utility classes (classes with only static members), and the main class. |
| |
| #PublicApiNamedStreamShouldReturnStream=WARN |
| # Public methods named stream() are generally expected to return a type whose name ends with Stream. Consider choosing a different method name instead. |
| |
| #RemoveUnusedImports=WARN |
| # Unused imports |
| |
| #ReturnMissingNullable=WARN |
| # Method returns a definitely null value but is not annotated @Nullable |
| |
| #ReturnsNullCollection=WARN |
| # Method has a collection return type and returns {@code null} in some cases but does not annotate the method as @Nullable. See Effective Java 3rd Edition Item 54. |
| |
| #ScopeOnModule=WARN |
| # Scopes on modules have no function and will soon be an error. |
| |
| #SwitchDefault=WARN |
| # The default case of a switch should appear at the end of the last statement group |
| |
| #SymbolToString=WARN |
| # Symbol#toString shouldn't be used for comparison as it is expensive and fragile. |
| |
| #ThrowsUncheckedException=WARN |
| # Unchecked exceptions do not need to be declared in the method signature. |
| |
| TryFailRefactoring=WARN |
| # Prefer assertThrows to try/fail |
| |
| #TypeParameterNaming=WARN |
| # Type parameters must be a single letter with an optional numeric suffix, or an UpperCamelCase name followed by the letter 'T'. |
| |
| #TypeToString=WARN |
| # Type#toString shouldn't be used for comparison as it is expensive and fragile. |
| |
| #UngroupedOverloads=WARN |
| # Constructors and methods with the same name should appear sequentially with no other code in between, even when modifiers such as static or private differ between the methods. Please re-order or re-name methods. |
| |
| UnnecessaryBoxedAssignment=WARN |
| # This expression can be implicitly boxed. |
| |
| UnnecessaryBoxedVariable=ERROR |
| # It is unnecessary for this variable to be boxed. Use the primitive instead. |
| |
| #UnnecessarySetDefault=WARN |
| # Unnecessary call to NullPointerTester#setDefault |
| |
| #UnnecessaryStaticImport=WARN |
| # Using static imports for types is unnecessary |
| |
| UseEnumSwitch=WARN |
| # Prefer using a switch instead of a chained if-else for enums |
| |
| #VoidMissingNullable=WARN |
| # The type Void is not annotated @Nullable |
| |
| #WildcardImport=WARN |
| # Wildcard imports, static or otherwise, should not be used |
| |
| #################################################################################################### |
| # SLF4j |
| # See https://github.com/KengoTODA/errorprone-slf4j |
| #################################################################################################### |
| |
| Slf4jPlaceholderMismatch=ERROR |
| Slf4jFormatShouldBeConst=ERROR |
| Slf4jLoggerShouldBePrivate=ERROR |
| Slf4jLoggerShouldBeFinal=ERROR |
| Slf4jLoggerShouldBeNonStatic=OFF |
| Slf4jIllegalPassedClass=ERROR |
| #Slf4jSignOnlyFormat=OFF |
| Slf4jDoNotLogMessageOfExceptionExplicitly=OFF |
| |