Bug patterns

This list is auto-generated from our sources.

Patterns which are marked Experimental will not be evaluated against your code, unless you specifically configure Error Prone. The default checks are marked On by default, and each release promotes some experimental checks after we’ve vetted them against Google’s codebase.

On by default : ERROR

AlwaysThrows
Detects calls that will fail at runtime

AndroidInjectionBeforeSuper
AndroidInjection.inject() should always be invoked before calling super.lifecycleMethod()

ArrayEquals
Reference equality used to compare arrays

ArrayFillIncompatibleType
Arrays.fill(Object[], Object) called with incompatible types.

ArrayHashCode
hashcode method on array does not hash array contents

ArrayToString
Calling toString on an array does not provide useful information

ArraysAsListPrimitiveArray
Arrays.asList does not autobox primitive arrays, as one might expect.

AsyncCallableReturnsNull
AsyncCallable should not return a null Future, only a Future whose result is null.

AsyncFunctionReturnsNull
AsyncFunction should not return a null Future, only a Future whose result is null.

AutoValueBuilderDefaultsInConstructor
Defaults for AutoValue Builders should be set in the factory method returning Builder instances, not the constructor

AutoValueConstructorOrderChecker
Arguments to AutoValue constructor are in the wrong order

BadAnnotationImplementation
Classes that implement Annotation must override equals and hashCode. Consider using AutoAnnotation instead of implementing Annotation by hand.

BadShiftAmount
Shift by an amount that is out of range

BanJNDI
Using JNDI may deserialize user input via the `Serializable` API which is extremely dangerous

BoxedPrimitiveEquality
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
Object serialized in Bundle may have been flattened to base type.

ChainingConstructorIgnoresParameter
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
A variable was checkNotNulled multiple times. Did you mean to check something else?

CheckReturnValue
The result of this call must be used

CollectionIncompatibleType
Incompatible type as argument to Object-accepting Java collections method

CollectionToArraySafeParameter
The type of the array parameter of Collection.toArray needs to be compatible with the array type

ComparableType
Implementing 'Comparable<T>' where T is not the same as the implementing class is incorrect, since it violates the symmetry contract of compareTo.

ComparingThisWithNull
this == null is always false, this != null is always true

ComparisonOutOfRange
Comparison to value that is out of range for the compared type

CompatibleWithAnnotationMisuse
@CompatibleWith's value is not a type argument.

CompileTimeConstant
Non-compile-time constant expression passed to parameter with @CompileTimeConstant type annotation.

ComputeIfAbsentAmbiguousReference
computeIfAbsent passes the map key to the provided class's constructor

ConditionalExpressionNumericPromotion
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
Compile-time constant expression overflows

DaggerProvidesNull
Dagger @Provides methods may not return null unless annotated with @Nullable

DangerousLiteralNull
This method is null-hostile: passing a null literal to it is always wrong

DeadException
Exception created but not thrown

DeadThread
Thread created but not started

DereferenceWithNullBranch
Dereference of an expression with a null branch

DiscardedPostfixExpression
The result of this unary operation on a lambda parameter is discarded

DoNotCall
This method should not be called.

DoNotMock
Identifies undesirable mocks.

DoubleBraceInitialization
Prefer collection factory methods or builders to the double-brace initialization pattern.

DuplicateMapKeys
Map#ofEntries will throw an IllegalArgumentException if there are any duplicate keys

DurationFrom
Duration.from(Duration) returns itself; from(Period) throws a runtime exception.

DurationGetTemporalUnit
Duration.get() only works with SECONDS or NANOS.

DurationTemporalUnit
Duration APIs only work for DAYS or exact durations.

DurationToLongTimeUnit
Unit mismatch when decomposing a Duration or Instant to call a <long, TimeUnit> API

EqualsHashCode
Classes that override equals should also override hashCode.

EqualsNaN
== NaN always returns false; use the isNaN methods instead

EqualsNull
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
== must be used in equals method to check equality to itself or an infinite loop will occur.

EqualsWrongThing
Comparing different pairs of fields/getters in an equals implementation is probably a mistake.

FloggerFormatString
Invalid printf-style format string

FloggerLogString
Arguments to log(String) must be compile-time constants or parameters annotated with @CompileTimeConstant. If possible, use Flogger's formatting log methods instead.

FloggerLogVarargs
logVarargs should be used to pass through format strings and arguments.

FloggerSplitLogStatement
Splitting log statements and using Api instances directly breaks logging.

ForOverride
Method annotated @ForOverride must be protected or package-private and only invoked from declaring class, or from an override of the method

FormatString
Invalid printf-style format string

FormatStringAnnotation
Invalid format string passed to formatting method.

FromTemporalAccessor
Certain combinations of javaTimeType.from(TemporalAccessor) will always throw a DateTimeException or return the parameter directly.

FunctionalInterfaceMethodChanged
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
Futures.getChecked requires a checked exception type with a standard constructor.

FuzzyEqualsShouldNotBeUsedInEqualsMethod
DoubleMath.fuzzyEquals should never be used in an Object.equals() method

GetClassOnAnnotation
Calling getClass() on an annotation may return a proxy class

GetClassOnClass
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
Checks for unguarded accesses to fields and methods with @GuardedBy annotations

GuiceAssistedInjectScoping
Scope annotation on implementation class of AssistedInject factory is not allowed

GuiceAssistedParameters
A constructor cannot have two @Assisted parameters of the same type unless they are disambiguated with named @Assisted annotations.

GuiceInjectOnFinalField
Although Guice allows injecting final fields, doing so is disallowed because the injected value may not be visible to other threads.

HashtableContains
contains() is a legacy method that is equivalent to containsValue()

IdentityBinaryExpression
A binary expression where both operands are the same is usually incorrect.

IdentityHashMapBoxing
Using IdentityHashMap with a boxed type as the key is risky since boxing may produce distinct instances

Immutable
Type declaration annotated with @Immutable is not immutable

ImpossibleNullComparison
This value cannot be null, and comparing it to null may be misleading.

Incomparable
Types contained in sorted collections must implement Comparable.

IncompatibleArgumentType
Passing argument to a generic method with an incompatible type.

IncompatibleModifiers
This annotation has incompatible modifiers as specified by its @IncompatibleModifiers annotation

IndexOfChar
The first argument to indexOf is a Unicode code point, and the second is the index to start the search from

InexactVarargsConditional
Conditional expression in varargs call contains array and non-array arguments

InfiniteRecursion
This method always recurses, and will cause a StackOverflowError

InjectMoreThanOneScopeAnnotationOnClass
A class can be annotated with at most one scope annotation.

InjectOnMemberAndConstructor
Members shouldn't be annotated with @Inject if constructor is already annotated @Inject

InlineMeValidator
Ensures that the @InlineMe annotation is used correctly.

InstantTemporalUnit
Instant APIs only work for NANOS, MICROS, MILLIS, SECONDS, MINUTES, HOURS, HALF_DAYS and DAYS.

InvalidJavaTimeConstant
This checker errors on calls to java.time methods using values that are guaranteed to throw a DateTimeException.

InvalidPatternSyntax
Invalid syntax used for a regular expression

InvalidTimeZoneID
Invalid time zone identifier. TimeZone.getTimeZone(String) will silently return GMT instead of the time zone you intended.

InvalidZoneId
Invalid zone identifier. ZoneId.of(String) will throw exception at runtime.

IsInstanceIncompatibleType
This use of isInstance will always evaluate to false.

IsInstanceOfClass
The argument to Class#isInstance(Object) should not be a Class

IsLoggableTagLength
Log tag too long, cannot exceed 23 characters.

JUnit3TestNotRun
Test method will not be run; please correct method signature (Should be public, non-static, and method name should begin with "test").

JUnit4ClassAnnotationNonStatic
This method should be static

JUnit4SetUpNotRun
setUp() method will not be run; please add JUnit's @Before annotation

JUnit4TearDownNotRun
tearDown() method will not be run; please add JUnit's @After annotation

JUnit4TestNotRun
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
This test is annotated @Test, but given it's within a class using the Enclosed runner, will not run.

JUnitAssertSameCheck
An object is tested for reference equality to itself using JUnit library.

JUnitParameterMethodNotFound
The method for providing parameters was not found.

JavaxInjectOnAbstractMethod
Abstract and default methods are not injectable with javax.inject.Inject

JodaToSelf
Use of Joda-Time's DateTime.toDateTime(), Duration.toDuration(), Instant.toInstant(), Interval.toInterval(), and Period.toPeriod() are not allowed.

LenientFormatStringValidation
The number of arguments provided to lenient format methods should match the positional specifiers.

LiteByteStringUtf8
This pattern will silently corrupt certain byte sequences from the serialized protocol message. Use ByteString or byte[] directly

LocalDateTemporalAmount
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
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
Loop condition is never modified in loop body.

LossyPrimitiveCompare
Using an unnecessarily-wide comparison method can lead to lossy comparison

MathRoundIntLong
Math.round(Integer) results in truncation

MislabeledAndroidString
Certain resources in `android.R.string` have names that do not match their content

MisplacedScopeAnnotations
Scope annotations used as qualifier annotations don't have any effect. Move the scope annotation to the binding location or delete it.

MissingSuperCall
Overriding method is missing a call to overridden super method

MissingTestCall
A terminating method call is required for a test helper to have any effect.

MisusedDayOfYear
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
Use of "YYYY" (week year) in a date pattern without "ww" (week in year). You probably meant to use "yyyy" (year) instead.

MixedDescriptors
The field number passed into #findFieldByNumber belongs to a different proto to the Descriptor.

MockitoUsage
Missing method call for verify(mock) here

ModifyingCollectionWithItself
Using a collection function with itself as the argument.

MoreThanOneInjectableConstructor
This class has more than one @Inject-annotated constructor. Please remove the @Inject annotation from all but one of them.

MustBeClosedChecker
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
The first argument to nCopies is the number of copies, and the second is the item to copy

NoCanIgnoreReturnValueOnClasses
@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
Static import of type uses non-canonical name

NonFinalCompileTimeConstant
@CompileTimeConstant parameters should be final or effectively final

NonRuntimeAnnotation
Calling getAnnotation on an annotation that is not retained at runtime

NullArgumentForNonNullParameter
Null is not permitted for this parameter.

NullTernary
This conditional expression may evaluate to null, which will result in an NPE when the result is unboxed.

NullableOnContainingClass
Type-use nullability annotations should annotate the inner class, not the outer class (e.g., write `A.@Nullable B` instead of `@Nullable A.B`).

OptionalEquality
Comparison using reference equality instead of value equality

OptionalMapUnusedValue
Optional.ifPresent is preferred over Optional.map when the return value is unused

OptionalOfRedundantMethod
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
Annotations cannot be both Scope annotations and Qualifier annotations: this causes confusion when trying to use them.

OverridesJavaxInjectableMethod
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
Declaring types inside package-info.java files is very bad form

ParametersButNotParameterized
This test has @Parameters but is using the default JUnit4 runner. The parameters will have no effect.

ParcelableCreator
Detects classes which implement Parcelable but don't have CREATOR

PeriodFrom
Period.from(Period) returns itself; from(Duration) throws a runtime exception.

PeriodGetTemporalUnit
Period.get() only works with YEARS, MONTHS, or DAYS.

PeriodTimeMath
When adding or subtracting from a Period, Duration is incompatible.

PreconditionsInvalidPlaceholder
Preconditions only accepts the %s placeholder in error message strings

PrivateSecurityContractProtoAccess
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
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().

ProtoStringFieldReferenceEquality
Comparing protobuf fields of type String using reference equality

ProtoTruthMixedDescriptors
The arguments passed to `ignoringFields` are inconsistent with the proto which is the subject of the assertion.

ProtocolBufferOrdinal
To get the tag number of a protocol buffer enum, use getNumber() instead.

ProvidesMethodOutsideOfModule
@Provides methods need to be declared in a Module to have any effect.

RandomCast
Casting a random number in the range [0.0, 1.0) to an integer or long always results in 0.

RandomModInteger
Use Random.nextInt(int). Random.nextInt() % n can have negative results

RectIntersectReturnValueIgnored
Return value of android.graphics.Rect.intersect() must be checked

RedundantSetterCall
A field was set twice in the same chained expression.

RequiredModifiers
This annotation is missing required modifiers as specified by its @RequiredModifiers annotation

RestrictedApi
Check for non-allowlisted callers to RestrictedApiChecker.

ReturnValueIgnored
Return value of this method must be used

SelfAssertion
This assertion will always fail or succeed.

SelfAssignment
Variable assigned to itself

SelfComparison
An object is compared to itself

SelfEquals
Testing an object for equality with itself will always be true.

SetUnrecognized
Setting a proto field to an UNRECOGNIZED value will result in an exception at runtime when building.

ShouldHaveEvenArgs
This method must be called with an even number of arguments.

SizeGreaterThanOrEqualsZero
Comparison of a size >= 0 is always true, did you intend to check for non-emptiness?

StreamToString
Calling toString on a Stream does not provide useful information

StringBuilderInitWithChar
StringBuilder does not have a char constructor; this invokes the int constructor.

SubstringOfZero
String.substring(0) returns the original String

SuppressWarningsDeprecated
Suppressing "deprecated" is probably a typo for "deprecation"

TemporalAccessorGetChronoField
TemporalAccessor.get() only works for certain values of ChronoField.

TestParametersNotInitialized
This test has @TestParameter fields but is using the default JUnit4 runner. The parameters will not be initialised beyond their default value.

TheoryButNoTheories
This test has members annotated with @Theory, @DataPoint, or @DataPoints but is using the default JUnit4 runner.

ThrowIfUncheckedKnownChecked
throwIfUnchecked(knownCheckedException) is a no-op.

ThrowNull
Throwing 'null' always results in a NullPointerException being thrown.

TreeToString
Tree#toString shouldn't be used for Trees deriving from the code being compiled, as it discards whitespace and comments.

TryFailThrowable
Catching Throwable/Error masks failures from fail() or assert*() in the try block

TypeParameterQualifier
Type parameter used as type qualifier

UnicodeDirectionalityCharacters
Unicode directionality modifiers can be used to conceal code in many editors.

UnicodeInCode
Avoid using non-ASCII Unicode characters outside of comments and literals, as they can be confusing.

UnnecessaryCheckNotNull
This null check is unnecessary; the expression can never be null

UnnecessaryTypeArgument
Non-generic methods should not be invoked with type arguments

UnsafeWildcard
Certain wildcard types can confuse the compiler.

UnusedAnonymousClass
Instance created but never used

UnusedCollectionModifiedInPlace
Collection is modified in place, but the result is not used

VarTypeName
`var` should not be used as a type name.

WrongOneof
This field is guaranteed not to be set given it's within a switch over a one_of.

XorPower
The `^` operator is binary XOR, not a power operator.

ZoneIdOfZ
Use ZoneOffset.UTC instead of ZoneId.of("Z").

On by default : WARNING

ASTHelpersSuggestions
Prefer ASTHelpers instead of calling this API directly

AddressSelection
Prefer InetAddress.getAllByName to APIs that convert a hostname to a single IP address

AlmostJavadoc
This comment contains Javadoc or HTML tags, but isn't started with a double asterisk (/**); is it meant to be Javadoc?

AlreadyChecked
This condition has already been checked.

AmbiguousMethodReference
Method reference is ambiguous

AnnotateFormatMethod
This method uses a pair of parameters as a format string and its arguments, but the enclosing method wasn't annotated @FormatMethod. Doing so gives compile-time rather than run-time protection against malformed format strings.

ArgumentSelectionDefectChecker
Arguments are in the wrong order or could be commented for clarity.

ArrayAsKeyOfSetOrMap
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.

ArrayRecordComponent
Record components should not be arrays.

AssertEqualsArgumentOrderChecker
Arguments are swapped in assertEquals-like call

AssertThrowsMultipleStatements
The lambda passed to assertThrows should contain exactly one statement

AssertionFailureIgnored
This assertion throws an AssertionError if it fails, which will be caught by an enclosing try block.

AssistedInjectAndInjectOnSameConstructor
@AssistedInject and @Inject cannot be used on the same constructor.

AttemptedNegativeZero
-0 is the same as 0. For the floating-point negative zero, use -0.0.

AutoValueBoxedValues
AutoValue instances should not usually contain boxed types that are not Nullable. We recommend removing the unnecessary boxing.

AutoValueFinalMethods
Make toString(), hashCode() and equals() final in AutoValue classes, so it is clear to readers that AutoValue is not overriding them

AutoValueImmutableFields
AutoValue recommends using immutable collections

AutoValueSubclassLeaked
Do not refer to the autogenerated AutoValue_ class outside the file containing the corresponding @AutoValue base class.

BadComparable
Possible sign flip from narrowing conversion

BadImport
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
instanceof used in a way that is equivalent to a null check.

BareDotMetacharacter
"." is rarely useful as a regex, as it matches any character. To match a literal '.' character, instead write "\.".

BigDecimalEquals
BigDecimal#equals has surprising behavior: it also compares scale.

BigDecimalLiteralDouble
new BigDecimal(double) loses precision in this case.

BoxedPrimitiveConstructor
valueOf or autoboxing provides better time and space performance

BugPatternNaming
Giving BugPatterns a name different to the enclosing class can be confusing

ByteBufferBackingArray
ByteBuffer.array() shouldn't be called unless ByteBuffer.arrayOffset() is used or if the ByteBuffer was initialized using ByteBuffer.wrap() or ByteBuffer.allocate().

CacheLoaderNull
The result of CacheLoader#load must be non-null.

CanonicalDuration
Duration can be expressed more clearly with different units

CatchAndPrintStackTrace
Logging or rethrowing exceptions should usually be preferred to catching and calling printStackTrace

CatchFail
Ignoring exceptions and calling fail() is unnecessary, and makes test output less useful

ChainedAssertionLosesContext
Inside a Subject, use check(…) instead of assert*() to preserve user-supplied messages and other settings.

CharacterGetNumericValue
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
Inner class is non-static but does not reference enclosing class

ClassInitializationDeadlock
Possible class initialization deadlock

ClassNewInstance
Class.newInstance() bypasses exception checking; prefer getDeclaredConstructor().newInstance()

CloseableProvides
Providing Closeable resources makes their lifecycle unclear

ClosingStandardOutputStreams
Don't use try-with-resources to manage standard output streams, closing the stream will cause subsequent output to standard output or standard error to be lost

CollectionUndefinedEquality
This type does not have well-defined equals behavior.

CollectorShouldNotUseState
Collector.of() should not use state

ComparableAndComparator
Class should not implement both `Comparable` and `Comparator`

CompareToZero
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
Non-trivial compile time constant boolean expressions shouldn't be used.

DateChecker
Warns against suspect looking calls to java.util.Date APIs

DateFormatConstant
DateFormat is not thread-safe, and should not be used as a constant field.

DeeplyNested
Very deeply nested code may lead to StackOverflowErrors during compilation

DefaultCharset
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
Java classes shouldn't use default package

DeprecatedVariable
Applying the @Deprecated annotation to local variables or parameters has no effect

DirectInvocationOnMock
Methods should not be directly invoked on mocks. Should this be part of a verify(..) call?

DistinctVarargsChecker
Method expects distinct arguments at some/all positions

DoNotCallSuggester
Consider annotating methods that always throw with @DoNotCall. Read more at https://errorprone.info/bugpattern/DoNotCall

DoNotClaimAnnotations
Don't 'claim' annotations in annotation processors; Processor#process should unconditionally return `false`

DoNotMockAutoValue
AutoValue classes represent pure data classes, so mocking them should not be necessary. Construct a real instance of the class instead.

DoubleCheckedLocking
Double-checked locking on non-volatile fields is unsafe

DuplicateDateFormatField
Reuse of DateFormat fields is most likely unintentional

EmptyBlockTag
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
Caught exceptions should not be ignored

EmptySetMultibindingContributions
@Multibinds is a more efficient and declarative mechanism for ensuring that a set multibinding is present in the graph.

EmptyTopLevelDeclaration
Empty top-level type declarations should be omitted

EnumOrdinal
You should almost never invoke the Enum.ordinal() method.

EqualsGetClass
Prefer instanceof to getClass when implementing Object#equals.

EqualsIncompatibleType
An equality test between objects with incompatible types always returns false

EqualsUnsafeCast
The contract of #equals states that it should return false for incompatible types, while this implementation may throw ClassCastException.

EqualsUsingHashCode
Implementing #equals by just comparing hashCodes is fragile. Hashes collide frequently, and this will lead to false positives in #equals.

ErroneousBitwiseExpression
This expression evaluates to 0. If this isn't an error, consider expressing it as a literal 0.

ErroneousThreadPoolConstructorChecker
Thread pool size will never go beyond corePoolSize if an unbounded queue is used

EscapedEntity
HTML entities in @code/@literal tags will appear literally in the rendered javadoc.

ExtendingJUnitAssert
When only using JUnit Assert's static methods, you should import statically instead of extending.

ExtendsObject
`T extends Object` is redundant (unless you are using the Checker Framework).

FallThrough
Switch case may fall through

Finalize
Do not override finalize

Finally
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
Use parentheses to make the precedence explicit

FloatingPointAssertionWithinEpsilon
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
Floating point literal loses precision

FloggerArgumentToString
Use Flogger's printf-style formatting instead of explicitly converting arguments to strings

FloggerStringConcatenation
Prefer string formatting using printf placeholders (e.g. %s) instead of string concatenation

FragmentInjection
Classes extending PreferenceActivity must implement isValidFragment such that it does not unconditionally return true to prevent vulnerability to fragment injection attacks.

FragmentNotInstantiable
Subclasses of Fragment must be instantiable via Class#newInstance(): the class must be public, static and have a public nullary constructor

FutureReturnValueIgnored
Return value of methods returning Future must be checked. Ignoring returned Futures suppresses exceptions thrown from the code that completes the Future.

FutureTransformAsync
Use transform instead of transformAsync when all returns are an immediate future.

GetClassOnEnum
Calling getClass() on an enum may return a subclass of the enum type

GuiceNestedCombine
Nesting Modules.combine() here is unnecessary.

HidingField
Hiding fields of superclasses may cause confusion and errors

ICCProfileGetInstance
This method searches the class path for the given file, prefer to read the file and call getInstance(byte[]) or getInstance(InputStream)

IdentityHashMapUsage
IdentityHashMap usage shouldn't be intermingled with Map

IgnoredPureGetter
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.

ImmutableAnnotationChecker
Annotations should always be immutable

ImmutableEnumChecker
Enums should always be immutable

InconsistentCapitalization
It is confusing to have a field and a parameter under the same scope that differ only in capitalization.

InconsistentHashCode
Including fields in hashCode which are not compared in equals violates the contract of hashCode.

IncorrectMainMethod
'main' methods must be public, static, and void

IncrementInForLoopAndHeader
This for loop increments the same variable in the header and in the body

InheritDoc
Invalid use of @inheritDoc.

InjectInvalidTargetingOnScopingAnnotation
A scoping annotation's Target should include TYPE and METHOD.

InjectOnBugCheckers
BugChecker constructors should be marked @Inject.

InjectOnConstructorOfAbstractClass
Constructors on abstract classes are never directly @Inject'ed, only the constructors of their subclasses can be @Inject'ed.

InjectScopeAnnotationOnInterfaceOrAbstractClass
Scope annotation on an interface or abstract class is not allowed

InjectedConstructorAnnotations
Injected constructors cannot be optional nor have binding annotations

InlineFormatString
Prefer to create format strings inline, instead of extracting them to a single-use constant

InlineMeInliner
Callers of this API should be inlined.

InlineMeSuggester
This deprecated API looks inlineable. If you'd like the body of the API to be automatically inlined to its callers, please annotate it with @InlineMe. NOTE: the suggested fix makes the method final if it was not already.

InlineTrivialConstant
Consider inlining this constant

InputStreamSlowMultibyteRead
Please also override int read(byte[], int, int), otherwise multi-byte reads from this input stream are likely to be slow.

InstanceOfAndCastMatchWrongType
Casting inside an if block should be plausibly consistent with the instanceof type

IntLongMath
Expression of type int may overflow before being assigned to a long

InvalidBlockTag
This tag is invalid.

InvalidInlineTag
This tag is invalid.

InvalidLink
This @link tag looks wrong.

InvalidParam
This @param tag doesn't refer to a parameter of the method.

InvalidThrows
The documented method doesn't actually throw this checked exception.

InvalidThrowsLink
Javadoc links to exceptions in @throws without a @link tag (@throws Exception, not @throws {@link Exception}).

IterableAndIterator
Class should not implement both `Iterable` and `Iterator`

JUnit3FloatingPointComparisonWithoutDelta
Floating-point comparison without error tolerance

JUnit4ClassUsedInJUnit3
Some JUnit4 construct cannot be used in a JUnit3 context. Convert your class to JUnit4 style to use them.

JUnitAmbiguousTestClass
Test class inherits from JUnit 3's TestCase but has JUnit 4 @Test or @RunWith annotations.

JUnitIncompatibleType
The types passed to this assertion are incompatible.

JavaDurationGetSecondsGetNano
duration.getNano() only accesses the underlying nanosecond adjustment from the whole second.

JavaDurationWithNanos
Use of java.time.Duration.withNanos(int) is not allowed.

JavaDurationWithSeconds
Use of java.time.Duration.withSeconds(long) is not allowed.

JavaInstantGetSecondsGetNano
instant.getNano() only accesses the underlying nanosecond adjustment from the whole second.

JavaLangClash
Never reuse class names from java.lang

JavaLocalDateTimeGetNano
localDateTime.getNano() only access the nanos-of-second field. It's rare to only use getNano() without a nearby getSecond() call.

JavaLocalTimeGetNano
localTime.getNano() only accesses the nanos-of-second field. It's rare to only use getNano() without a nearby getSecond() call.

JavaPeriodGetDays
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
java.time APIs that silently use the default system time-zone are not allowed.

JavaUtilDate
Date has a bad API that leads to bugs; prefer java.time.Instant or LocalDate.

JavaxInjectOnFinalField
@javax.inject.Inject cannot be put on a final field.

JdkObsolete
Suggests alternatives to obsolete JDK classes.

JodaConstructors
Use of certain JodaTime constructors are not allowed.

JodaDateTimeConstants
Using the `PER` constants in `DateTimeConstants` is problematic because they encourage manual date/time math.

JodaDurationWithMillis
Use of duration.withMillis(long) is not allowed. Please use Duration.millis(long) instead.

JodaInstantWithMillis
Use of instant.withMillis(long) is not allowed. Use Instant.ofEpochMilli(long) instead.

JodaNewPeriod
This may have surprising semantics, e.g. new Period(LocalDate.parse("1970-01-01"), LocalDate.parse("1970-02-02")).getDays() == 1, not 32.

JodaPlusMinusLong
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
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
Use of JodaTime's type.withDurationAdded(long, int) (where <type> = {Duration,Instant,DateTime}). Please use type.withDurationAdded(Duration.millis(long), int) instead.

LabelledBreakTarget
Labels should only be used on loops.

LiteEnumValueOf
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
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
Calls to Lock#lock should be immediately followed by a try block which releases the lock.

LockOnNonEnclosingClassLiteral
Lock on the class other than the enclosing class of the code block can unintentionally prevent the locked class being used properly.

LogicalAssignment
Assignment where a boolean expression was expected; use == if this assignment wasn't expected or add parentheses for clarity.

LongDoubleConversion
Conversion from long to double may lose precision; use an explicit cast to double if this was intentional

LongFloatConversion
Conversion from long to float may lose precision; use an explicit cast to float if this was intentional

LoopOverCharArray
toCharArray allocates a new array, using charAt is more efficient

MalformedInlineTag
This Javadoc tag is malformed. The correct syntax is {@tag and not @{tag.

MathAbsoluteNegative
Math.abs does not always give a non-negative result. Please consider other methods for positive numbers.

MemoizeConstantVisitorStateLookups
Anytime you need to look up a constant value from VisitorState, improve performance by creating a cache for it with VisitorState.memoize

MissingCasesInEnumSwitch
Switches on enum types should either handle all values, or have a default case.

MissingFail
Not calling fail() when expecting an exception masks bugs

MissingImplementsComparable
Classes implementing valid compareTo function should implement Comparable interface

MissingOverride
method overrides method in supertype; expected @Override

MissingRefasterAnnotation
The Refaster template contains a method without any Refaster annotations

MissingSummary
A summary line is required on public/protected Javadocs.

MixedMutabilityReturnType
This method returns both mutable and immutable collections or maps from different paths. This may be confusing for users of the method.

MockNotUsedInProduction
This mock is instantiated and configured, but is never passed to production code. It should be either removed or used.

ModifiedButNotUsed
A collection or proto builder was created, but its values were never accessed.

ModifyCollectionInEnhancedForLoop
Modifying a collection while iterating over it in a loop may cause a ConcurrentModificationException to be thrown or lead to undefined behavior.

ModifySourceCollectionInStream
Modifying the backing source during stream operations may cause unintended results.

MultimapKeys
Iterating over `Multimap.keys()` does not collapse duplicates. Did you mean `keySet()`?

MultipleNullnessAnnotations
This type use has conflicting nullness annotations

MultipleParallelOrSequentialCalls
Multiple calls to either parallel or sequential are unnecessary and cause confusion.

MultipleUnaryOperatorsInMethodCall
Avoid having multiple unary operators acting on the same variable in a method call

MutablePublicArray
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.

NamedLikeContextualKeyword
Avoid naming of classes and methods that is similar to contextual keywords. When invoking such a method, qualify it.

NarrowCalculation
This calculation may lose precision compared to its target type.

NarrowingCompoundAssignment
Compound assignments may hide dangerous casts

NegativeCharLiteral
Casting a negative signed literal to an (unsigned) char might be misleading.

NestedInstanceOfConditions
Nested instanceOf conditions of disjoint types create blocks of code that never execute

NewFileSystem
Starting in JDK 13, this call is ambiguous with FileSystem.newFileSystem(Path,Map)

NonApiType
Certain types should not be passed across API boundaries.

NonAtomicVolatileUpdate
This update of a volatile variable is non-atomic

NonCanonicalType
This type is referred to by a non-canonical name, which may be misleading.

NonOverridingEquals
equals method doesn't override Object.equals

NotJavadoc
Avoid using `/**` for comments which aren't actually Javadoc.

NullOptional
Passing a literal null to an Optional parameter is almost certainly a mistake. Did you mean to provide an empty Optional?

NullableConstructor
Constructors should not be annotated with @Nullable since they cannot return null

NullableOptional
Using an Optional variable which is expected to possibly be null is discouraged. It is best to indicate the absence of the value by assigning it an empty optional.

NullablePrimitive
Nullness annotations should not be used for primitive types since they cannot be null

NullablePrimitiveArray
@Nullable type annotations should not be used for primitive types since they cannot be null

NullableTypeParameter
Nullness annotations directly on type parameters are interpreted differently by different tools

NullableVoid
void-returning methods should not be annotated with nullness annotations, since they cannot return null

NullableWildcard
Nullness annotations directly on wildcard types are interpreted differently by different tools

ObjectEqualsForPrimitives
Avoid unnecessary boxing by using plain == for primitive types.

ObjectToString
Calling toString on Objects that don't override toString() doesn't provide useful information

ObjectsHashCodePrimitive
Objects.hashCode(Object o) should not be passed a primitive value

OperatorPrecedence
Use grouping parenthesis to make the operator precedence explicit

OptionalMapToOptional
Mapping to another Optional will yield a nested Optional. Did you mean flatMap?

OptionalNotPresent
This Optional has been confirmed to be empty at this point, so the call to `get()` or `orElseThrow()` will always throw.

OrphanedFormatString
String literal contains format specifiers, but is not passed to a format method

OutlineNone
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
To return a custom message with a Throwable class, one should override getMessage() instead of toString().

Overrides
Varargs doesn't agree for overridden method

OverridesGuiceInjectableMethod
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.

OverridingMethodInconsistentArgumentNamesChecker
Arguments of overriding method are inconsistent with overridden method.

ParameterName
Detects `/* name= */`-style comments on actual parameters where the name doesn't match the formal parameter

PatternMatchingInstanceof
This code can be simplified to use a pattern-matching instanceof.

PreconditionsCheckNotNullRepeated
Including the first argument of checkNotNull in the failure message is not useful, as it will always be `null`.

PrimitiveAtomicReference
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
Protected members in final classes can be package-private

ProtoDurationGetSecondsGetNano
getNanos() only accesses the underlying nanosecond-adjustment of the duration.

ProtoTimestampGetSecondsGetNano
getNanos() only accesses the underlying nanosecond-adjustment of the instant.

QualifierOrScopeOnInjectMethod
Qualifiers/Scope annotations on @Inject methods don't have any effect. Move the qualifier annotation to the binding location.

ReachabilityFenceUsage
reachabilityFence should always be called inside a finally block

ReferenceEquality
Comparison using reference equality instead of value equality

RethrowReflectiveOperationExceptionAsLinkageError
Prefer LinkageError for rethrowing ReflectiveOperationException as unchecked

ReturnAtTheEndOfVoidFunction
`return;` is unnecessary at the end of void methods and constructors.

ReturnFromVoid
Void methods should not have a @return tag.

RobolectricShadowDirectlyOn
Migrate off a deprecated overload of org.robolectric.shadow.api.Shadow#directlyOn

RxReturnValueIgnored
Returned Rx objects must be checked. Ignoring a returned Rx value means it is never scheduled for execution

SameNameButDifferent
This type name shadows another in a way that may be confusing.

SelfAlwaysReturnsThis
Non-abstract instance methods named 'self()' or 'getThis()' that return the enclosing class must always 'return this'

ShortCircuitBoolean
Prefer the short-circuiting boolean operators && and || to & and |.

StatementSwitchToExpressionSwitch
This statement switch can be converted to an equivalent expression switch

StaticAssignmentInConstructor
This assignment is to a static field. Mutating static state from a constructor is highly error-prone.

StaticAssignmentOfThrowable
Saving instances of Throwable in static fields is discouraged, prefer to create them on-demand when an exception is thrown

StaticGuardedByInstance
Writes to static fields should not be guarded by instance locks

StaticMockMember
@Mock members of test classes shouldn't share state between tests and preferably be non-static

StreamResourceLeak
Streams that encapsulate a closeable resource should be closed using try-with-resources

StreamToIterable
Using stream::iterator creates a one-shot Iterable, which may cause surprising failures.

StringCaseLocaleUsage
Specify a `Locale` when calling `String#to{Lower,Upper}Case`. (Note: there are multiple suggested fixes; the third may be most appropriate if you're dealing with ASCII Strings.)

StringCharset
StringCharset

StringSplitter
String.split(String) has surprising behavior

SuperCallToObjectMethod
`super.equals(obj)` and `super.hashCode()` are often bugs when they call the methods defined in `java.lang.Object`

SwigMemoryLeak
SWIG generated code that can't call a C++ destructor will leak memory

SynchronizeOnNonFinalField
Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects.

SystemConsoleNull
System.console() no longer returns null in JDK 22 and newer versions

ThreadJoinLoop
Thread.join needs to be immediately surrounded by a loop until it succeeds. Consider using Uninterruptibles.joinUninterruptibly.

ThreadLocalUsage
ThreadLocals should be stored in static fields

ThreadPriorityCheck
Relying on the thread scheduler is discouraged.

ThreeLetterTimeZoneID
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
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
An implementation of Object.toString() should never return null.

TraditionalSwitchExpression
Prefer -> switches for switch expressions

TruthAssertExpected
The actual and expected values appear to be swapped, which results in poor assertion failure messages. The actual value should come first.

TruthConstantAsserts
Truth Library assert is called on a constant.

TruthGetOrDefault
Asserting on getOrDefault is unclear; prefer containsEntry or doesNotContainKey

TruthIncompatibleType
Argument is not compatible with the subject's type.

TypeEquals
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
Type parameter declaration shadows another named type

TypeParameterShadowing
Type parameter declaration overrides another type parameter already declared

TypeParameterUnusedInFormals
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
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
This type is not guaranteed to implement a useful #equals method.

UnicodeEscape
Using unicode escape sequences for printable ASCII characters is obfuscated, and potentially dangerous.

UnnecessaryAssignment
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.

UnnecessaryAsync
Variables which are initialized and do not escape the current scope do not need to worry about concurrency. Using the non-concurrent type will reduce overhead and verbosity.

UnnecessaryBreakInSwitch
This break is unnecessary, fallthrough does not occur in -> switches

UnnecessaryLambda
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
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
It is not necessary to wrap a MethodMatcher with methodInvocation().

UnnecessaryMethodReference
This method reference is unnecessary, and can be replaced with the variable itself.

UnnecessaryParentheses
These grouping parentheses are unnecessary; it is unlikely the code will be misinterpreted without them

UnnecessaryStringBuilder
Prefer string concatenation over explicitly using `StringBuilder#append`, since `+` reads better and has equivalent or better performance.

UnrecognisedJavadocTag
This Javadoc tag wasn't recognised by the parser. Is it malformed somehow, perhaps with mismatched braces?

UnsafeFinalization
Finalizer may run before native code finishes execution

UnsafeReflectiveConstructionCast
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
Unsynchronized method overrides a synchronized method.

UnusedLabel
This label is unused.

UnusedMethod
Unused.

UnusedNestedClass
This nested class is unused, and can be removed.

UnusedTypeParameter
This type parameter is unused and can be removed.

UnusedVariable
Unused.

UseBinds
@Binds is a more efficient and declarative mechanism for delegating a binding.

VariableNameSameAsType
variableName and type with the same name would refer to the static field instead of the class

VoidUsed
Using a Void-typed variable is potentially confusing, and can be replaced with a literal `null`.

WaitNotInLoop
Because of spurious wakeups, Object.wait() and Condition.await() must always be called in a loop

WakelockReleasedDangerously
On Android versions < P, 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
withSignature is discouraged. Prefer .named and/or .withParameters where possible.

Experimental : ERROR

AndroidJdkLibsChecker
Use of class, field, or method that is not compatible with legacy Android devices

AutoFactoryAtInject
@AutoFactory and @Inject should not be used in the same type.

BanClassLoader
Using dangerous ClassLoader APIs may deserialize untrusted user input into bytecode, leading to remote code execution vulnerabilities

BanSerializableRead
Deserializing user input via the `Serializable` API is extremely dangerous

ClassName
The source file name should match the name of the top-level class it contains

ComparisonContractViolated
This comparison method violates the contract

DeduplicateConstants
This expression was previously declared as a constant; consider replacing this occurrence.

DepAnn
Item documented with a @deprecated javadoc note is not annotated with @Deprecated

EmptyIf
Empty statement after if

ExtendsAutoValue
Do not extend an @AutoValue/@AutoOneOf class in non-generated code.

InjectMoreThanOneQualifier
Using more than one qualifier annotation on the same element is not allowed.

InsecureCryptoUsage
A standard cryptographic operation is used in a mode that is prone to vulnerabilities

IterablePathParameter
Path implements Iterable<Path>; prefer Collection<Path> for clarity

Java7ApiChecker
Use of class, field, or method that is not compatible with JDK 7

Java8ApiChecker
Use of class, field, or method that is not compatible with JDK 8

LongLiteralLowerCaseSuffix
Prefer 'L' to 'l' for the suffix to long literals

MissingRuntimeRetention
Scoping and qualifier annotations must have runtime retention.

NoAllocation
@NoAllocation was specified on this method, but something was found that would trigger an allocation

RefersToDaggerCodegen
Don't refer to Dagger's internal or generated code

StaticOrDefaultInterfaceMethod
Static and default interface methods are not natively supported on older Android devices.

StaticQualifiedUsingExpression
A static variable or method should be qualified with a class name, not expression

SystemExitOutsideMain
Code that contains System.exit() is untestable.

ThreadSafe
Type declaration annotated with @ThreadSafe is not thread safe

UseCorrectAssertInTests
Java assert is used in testing code. For testing purposes, prefer using Truth-based assertions.

Experimental : WARNING

AnnotationPosition
Annotations should be positioned after Javadocs, but before modifiers.

AssertFalse
Assertions may be disabled at runtime and do not guarantee that execution will halt here; consider throwing an exception instead

AssistedInjectAndInjectOnConstructors
@AssistedInject and @Inject should not be used on different constructors in the same class.

AvoidObjectArrays
Object arrays are inferior to collections in almost every way. Prefer immutable collections (e.g., ImmutableSet, ImmutableList, etc.) over an object array whenever possible.

BinderIdentityRestoredDangerously
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
This code declares a binding for a common value type without a Qualifier annotation.

BuilderReturnThis
Builder instance method does not return 'this'

CanIgnoreReturnValueSuggester
Methods that always return 'this' (or return an input parameter) should be annotated with @com.google.errorprone.annotations.CanIgnoreReturnValue

CannotMockFinalClass
Mockito cannot mock final classes

CannotMockMethod
Mockito cannot mock final or static methods, and can't detect this at runtime

CatchingUnchecked
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
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
Variables initialized with Pattern#compile calls on constants can be constants

DefaultLocale
Implicit use of the JVM default locale, which can result in differing behaviour between JVM executions.

DifferentNameButSame
This type is referred to in different ways within this file, which may be confusing.

DoNotUseRuleChain
Prefer using `@Rule` with an explicit order over declaring a `RuleChain`. RuleChain was the only way to declare ordered rules before JUnit 4.13. Newer versions should use the cleaner individual `@Rule(order = n)` option. The rules with a higher value are inner.

EqualsBrokenForNull
equals() implementation may throw NullPointerException when given null

ExpectedExceptionChecker
Prefer assertThrows to ExpectedException

FloggerLogWithCause
Setting the caught exception as the cause of the log message may provide more context for anyone debugging errors.

FloggerMessageFormat
Invalid message format-style format specifier ({0}), expected printf-style (%s)

FloggerRedundantIsEnabled
Logger level check is already implied in the log() call. An explicit atLEVEL().isEnabled() check is redundant.

FloggerRequiredModifiers
FluentLogger.forEnclosingClass should always be saved to a private static final field.

FloggerWithCause
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
Use withCause to associate Exceptions with log statements

FunctionalInterfaceClash
Overloads will be ambiguous when passing lambda arguments.

HardCodedSdCardPath
Hardcoded reference to /sdcard

InconsistentOverloads
The ordering of parameters in overloaded methods should be as consistent as possible (when viewed from left to right)

InitializeInline
Initializing variables in their declaring statement is clearer, where possible.

InterfaceWithOnlyStatics
This interface only contains static fields and methods; consider making it a final class instead to prevent subclassing.

InterruptedExceptionSwallowed
This catch block appears to be catching an explicitly declared InterruptedException as an Exception/Throwable and not handling the interruption separately.

Interruption
Always pass 'false' to 'Future.cancel()', unless you are propagating a cancellation-with-interrupt from another caller

MemberName
Methods and non-static variables should be named in lowerCamelCase

MissingDefault
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.)

MockitoDoSetup
Prefer using when/thenReturn over doReturn/when for additional type safety.

MutableGuiceModule
Fields in Guice modules should be final

NonCanonicalStaticMemberImport
Static import of member uses non-canonical name

NonFinalStaticField
Static fields should almost always be final.

PreferJavaTimeOverload
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
This type can be more specific.

PrimitiveArrayPassedToVarargsMethod
Passing a primitive array to a varargs method is usually wrong

QualifierWithTypeUse
Injection frameworks currently don't understand Qualifiers in TYPE_PARAMETER or TYPE_USE contexts.

RedundantOverride
This overriding method is redundant, and can be removed.

RedundantThrows
Thrown exception is a subtype of another

StringFormatWithLiteral
There is no need to use String.format() when all the arguments are literals.

StronglyTypeByteString
This primitive byte array is only used to construct ByteStrings. It would be clearer to strongly type the field instead.

StronglyTypeTime
This primitive integral type is only used to construct time types. It would be clearer to strongly type the field instead.

SunApi
Usage of internal proprietary API which may be removed in a future release

SuppressWarningsWithoutExplanation
Use of @SuppressWarnings should be accompanied by a comment describing why the warning is safe to ignore.

SystemOut
Printing to standard output should only be used for debugging, not in production code

TestExceptionChecker
Using @Test(expected=…) is discouraged, since the test will pass if any statement in the test method throws the expected exception

ThrowSpecificExceptions
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
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
A large number of parameters on public APIs should be avoided.

TransientMisuse
Static fields are implicitly transient, so the explicit modifier is unnecessary

TruthContainsExactlyElementsInUsage
containsExactly is preferred over containsExactlyElementsIn when creating new iterables.

TryWithResourcesVariable
This variable is unnecessary, the try-with-resources resource can be a reference to a final or effectively final variable

UnescapedEntity
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.

UnnecessarilyFullyQualified
This fully qualified name is unambiguous to the compiler if imported.

UnnecessarilyUsedValue
The result of this API is ignorable, so it does not need to be captured / assigned into an `unused` variable.

UnnecessarilyVisible
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
Implementing a functional interface is unnecessary; prefer to implement the functional interface method directly and use a method reference instead.

UnnecessaryDefaultInEnumSwitch
Switch handles all enum values: an explicit default case is unnecessary and defeats error checking for non-exhaustive switches.

UnnecessaryFinal
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
This code can be simplified by directly using the lambda parameters instead of calling get..() on optional.

UnnecessaryTestMethodPrefix
A `test` prefix for a JUnit4 test is redundant, and a holdover from JUnit3. The `@Test` annotation makes it clear it's a test.

UnsafeLocaleUsage
Possible unsafe operation related to the java.util.Locale library.

UnusedException
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
URLs should not be used in @see tags; they are designed for Java elements which could be used with @link.

UsingJsr305CheckReturnValue
Prefer ErrorProne's @CheckReturnValue over JSR305's version.

Var
Non-constant variable missing @Var annotation

Varifier
Consider using `var` here to avoid boilerplate.

YodaCondition
The non-constant portion of an equals check generally comes first. Prefer e.equals(CONSTANT) if e is non-null or Objects.equals(e, CONSTANT) if e may be

Experimental : SUGGESTION

AnnotationMirrorToString
AnnotationMirror#toString doesn't use fully qualified type names, prefer auto-common's AnnotationMirrors#toString

AnnotationValueToString
AnnotationValue#toString doesn't use fully qualified type names, prefer auto-common's AnnotationValues#toString

BooleanParameter
Use parameter comments to document ambiguous literals

ClassNamedLikeTypeParameter
This class's name looks like a Type Parameter.

ConstantField
Fields with CONSTANT_CASE names should be both static and final

EqualsMissingNullable
Method overrides Object.equals but does not have @Nullable on its parameter

FieldCanBeFinal
This field is only assigned during initialization; consider making it final

FieldCanBeLocal
This field can be replaced with a local variable in the methods that use it.

FieldCanBeStatic
A final field initialized at compile-time with an instance of an immutable type can be static.

FieldMissingNullable
Field is assigned (or compared against) a definitely null value but is not annotated @Nullable

ForEachIterable
This loop can be replaced with an enhanced for loop.

ImmutableMemberCollection
If you don't intend to mutate a member collection prefer using Immutable types.

ImmutableRefactoring
Refactors uses of the JSR 305 @Immutable to Error Prone's annotation

ImmutableSetForContains
This private static ImmutableList is only used for contains, containsAll or isEmpty checks; prefer ImmutableSet.

ImplementAssertionWithChaining
Prefer check(…), which usually generates more readable failure messages.

LambdaFunctionalInterface
Use Java's utility functional interfaces instead of Function<A, B> for primitive types.

MethodCanBeStatic
A private method that does not reference the enclosing instance can be static

MissingBraces
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
C-style array declarations should not be used

MultiVariableDeclaration
Variable declarations should declare only one variable

MultipleTopLevelClasses
Source files should not contain multiple top-level class declarations

PackageLocation
Package names should match the directory they are declared in

ParameterComment
Non-standard parameter comment; prefer `/* paramName= */ arg`

ParameterMissingNullable
Parameter has handling for null but is not annotated @Nullable

PrivateConstructorForNoninstantiableModule
Add a private constructor to modules that will not be instantiated by Dagger.

PrivateConstructorForUtilityClass
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
Public methods named stream() are generally expected to return a type whose name ends with Stream. Consider choosing a different method name instead.

RemoveUnusedImports
Unused imports

ReturnMissingNullable
Method returns a definitely null value but is not annotated @Nullable

ReturnsNullCollection
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
Scopes on modules have no function and will soon be an error.

SwitchDefault
The default case of a switch should appear at the end of the last statement group

SymbolToString
Element#toString shouldn't be used for comparison as it is expensive and fragile.

ThrowsUncheckedException
Unchecked exceptions do not need to be declared in the method signature.

TryFailRefactoring
Prefer assertThrows to try/fail

TypeParameterNaming
Type parameters must be a single letter with an optional numeric suffix, or an UpperCamelCase name followed by the letter 'T'.

TypeToString
TypeMirror#toString shouldn't be used for comparison as it is expensive and fragile.

UngroupedOverloads
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
This expression can be implicitly boxed.

UnnecessaryBoxedVariable
It is unnecessary for this variable to be boxed. Use the primitive instead.

UnnecessarySetDefault
Unnecessary call to NullPointerTester#setDefault

UnnecessaryStaticImport
Using static imports for types is unnecessary

UseEnumSwitch
Prefer using a switch instead of a chained if-else for enums

VoidMissingNullable
The type Void is not annotated @Nullable

WildcardImport
Wildcard imports, static or otherwise, should not be used