Uses of Interface
com.google.errorprone.bugpatterns.BugChecker.MethodInvocationTreeMatcher
Package | Description |
---|---|
com.google.errorprone.bugpatterns |
Checks added to the java compiler which detect common bug patterns.
|
com.google.errorprone.bugpatterns.android | |
com.google.errorprone.bugpatterns.argumentselectiondefects | |
com.google.errorprone.bugpatterns.collectionincompatibletype | |
com.google.errorprone.bugpatterns.flogger | |
com.google.errorprone.bugpatterns.formatstring | |
com.google.errorprone.bugpatterns.inject.dagger |
Bug patterns related to Dagger.
|
com.google.errorprone.bugpatterns.inject.guice |
Bug patterns related to Guice.
|
com.google.errorprone.bugpatterns.inlineme | |
com.google.errorprone.bugpatterns.nullness | |
com.google.errorprone.bugpatterns.threadsafety | |
com.google.errorprone.bugpatterns.time |
-
Uses of BugChecker.MethodInvocationTreeMatcher in com.google.errorprone.bugpatterns
Classes in com.google.errorprone.bugpatterns that implement BugChecker.MethodInvocationTreeMatcher Modifier and Type Class Description class
AbstractAsKeyOfSetOrMap
Check for usage ofSet<T>
orMap<T, E>
.class
AbstractMockChecker<T extends Annotation>
Helper for enforcing Annotations that disallow mocking.class
AbstractPatternSyntaxChecker
Finds calls to regex-accepting methods with literal strings.class
AbstractReturnValueIgnored
An abstract base class to match API usages in which the return value is not used.class
AbstractToString
An abstract matcher for implicit and explicit calls toObject.toString()
, for use on types that do not have a human-readabletoString()
implementation.class
AlwaysThrows
ABugChecker
; see the associatedBugPattern
annotation for details.class
AnnotateFormatMethod
Detects occurrences of pairs of parameters being passed straight through toString.format(java.lang.String, java.lang.Object...)
from a method not annotated withFormatMethod
.class
AnnotationMirrorToString
ABugChecker
; see the associatedBugPattern
annotation for details.class
AnnotationValueToString
ABugChecker
; see the associatedBugPattern
annotation for details.class
ArrayAsKeyOfSetOrMap
Warns that users should not have an array as a key to a Set or Mapclass
ArrayEquals
class
ArrayFillIncompatibleType
Checks when Arrays.fill(Object[], Object) is called with object types that are guaranteed to result in an ArrayStoreException.class
ArrayHashCode
class
ArraysAsListPrimitiveArray
class
ArrayToString
class
AssertionFailureIgnored
ABugChecker
; see the associatedBugPattern
annotation for details.class
AssertThrowsMultipleStatements
ABugChecker
; see the associatedBugPattern
annotation for details.class
ASTHelpersSuggestions
A BugPattern; see the summaryclass
BanJNDI
ABugChecker
that detects use of the unsafe JNDI API system.class
BanSerializableRead
ABugChecker
that detects use of the unsafeSerializable
API.class
BareDotMetacharacter
A BugChecker; see the associated BugPattern for details.class
BigDecimalEquals
Matches use ofBigDecimal#equals
, which compares scale as well (which is not likely to be intended).class
BooleanParameter
ABugChecker
; see the associatedBugPattern
annotation for details.class
ByteBufferBackingArray
Checks when ByteBuffer.array() is used without calling .arrayOffset() to know the offset of the array, or when the buffer wasn't initialized using ByteBuffer.wrap() or ByteBuffer.allocate().class
CannotMockFinalClass
Bug pattern to recognize attempts to mock final types.class
CannotMockMethod
A BugPattern; see the summaryclass
CanonicalDuration
ABugChecker
; see the associatedBugPattern
annotation for details.class
ChainedAssertionLosesContext
Identifies calls toassertThat
and similar methods inside the implementation of aSubject
assertion method.class
ChainingConstructorIgnoresParameter
Checks, if two constructors in a class both acceptFoo foo
and one calls the other, that the caller passesfoo
as a parameter.class
CharacterGetNumericValue
Checks for use of Character.getNumericValue and UCharacter.getNumericValueclass
CheckReturnValue
class
ClassNewInstance
ABugChecker
; see the associatedBugPattern
annotation for details.class
CollectionToArraySafeParameter
class
CollectorShouldNotUseState
class
CompareToZero
Suggests comparing the result ofcompareTo
to only0
.class
CompileTimeConstantChecker
A Bugpattern; see the accompanying Markdown documentation.class
ComputeIfAbsentAmbiguousReference
Flags ambiguous creations of objects inMap.computeIfAbsent(K, java.util.function.Function<? super K, ? extends V>)
.class
DefaultCharset
ABugChecker
; see the associatedBugPattern
annotation for details.class
DistinctVarargsChecker
ErrorProne checker to generate warning when method expecting distinct varargs is invoked with same variable argument.class
DoNotMockAutoValue
Suggests not mocking AutoValue classes.class
DoNotMockChecker
Points out if a Mockito or EasyMock mock is mocking an object that would be better off being tested using an alternative instance.class
DuplicateMapKeys
Flags duplicate keys used in ImmutableMap construction.class
EqualsGetClass
Discourages the use ofObject.getClass()
when implementingObject.equals(Object)
for non-final classes.class
EqualsIncompatibleType
class
EqualsNull
ABugChecker
; see the associatedBugPattern
annotation for details.class
EqualsUsingHashCode
Discourages implementingequals
usinghashCode
.class
FloatingPointAssertionWithinEpsilon
Detects usages ofFloat,DoubleSubject.isWithin(TOLERANCE).of(EXPECTED)
where there are no other floating point values other thanEXPECTED
with satisfy the assertion, butTOLERANCE
is not zero.class
ForOverrideChecker
Verifies that methods markedForOverride
are only called from the defining class.class
FutureReturnValueIgnored
See BugPattern annotation.class
FuturesGetCheckedIllegalExceptionType
Checks for calls to Guava'sFutures.getChecked
method that will always fail because they pass an incompatible exception type.class
FuzzyEqualsShouldNotBeUsedInEqualsMethod
class
GetClassOnAnnotation
ABugChecker
; see the associatedBugPattern
annotation for details.class
GetClassOnClass
class
GetClassOnEnum
ABugChecker
; see the associatedBugPattern
annotation for details.class
HashtableContains
ABugChecker
; see the associatedBugPattern
annotation for details.class
IdentityHashMapBoxing
ABugChecker
; see the associatedBugPattern
annotation for details.class
IdentityHashMapUsage
ABugChecker
; see the associatedBugPattern
annotation for details.class
IgnoredPureGetter
Flags ignored return values from pure getters.class
IndexOfChar
ABugChecker
; see the associatedBugPattern
annotation for details.class
InexactVarargsConditional
ABugChecker
; see the associatedBugPattern
annotation for details.class
InsecureCipherMode
class
Interruption
ABugChecker
; see the associatedBugPattern
annotation for details.class
InvalidPatternSyntax
class
InvalidTimeZoneID
class
InvalidZoneId
Validates ZoneId.class
IsInstanceIncompatibleType
class
IsInstanceOfClass
ABugChecker
; see the associatedBugPattern
annotation for details.class
JavaUtilDateChecker
ABugChecker
; see the associatedBugPattern
annotation for details.class
JUnit3FloatingPointComparisonWithoutDelta
Detects floating-point assertEquals() calls that will not work in JUnit 4.class
JUnit4ClassUsedInJUnit3
class
JUnitAssertSameCheck
Points out if an object is tested for reference equality to itself using JUnit library.class
LenientFormatStringValidation
A BugPattern; see the summary.class
LiteByteStringUtf8
class
LiteEnumValueOf
Points out if #valueOf() is called on a Protocol Buffer Enum.class
LiteProtoToString
Flags calls totoString
on lite protos.class
LockNotBeforeTry
Suggests that calls toLock.lock
must be immediately followed by atry-finally
that callsLock.unlock
.class
LockOnBoxedPrimitive
Detects locks on boxed primitives.class
LongDoubleConversion
ABugChecker
; see the associatedBugPattern
annotation for details.class
LongFloatConversion
ABugChecker
; see the associatedBugPattern
annotation for details.class
LossyPrimitiveCompare
Checker to prevent usages of comparison methods where both the operands undergo lossy widening.class
MathAbsoluteNegative
class
MathRoundIntLong
Check for calls to Math'sMath.round(float)
with an integer or long parameter.class
MisusedDateFormat
Base class for checks which find common errors in date format patterns.class
MisusedDayOfYear
Ban use of D (day-of-year) in a date format pattern that also contains M (month-of-year).class
MisusedWeekYear
Ban use of YYYY in a SimpleDateFormat pattern, unless it is being used for a week date.class
MixedDescriptors
Checks for calls toDescriptor#findFieldByNumber
with field numbers from a different proto.class
MockitoUsage
ABugChecker
; see the associatedBugPattern
annotation for details.class
ModifyCollectionInEnhancedForLoop
class
ModifyingCollectionWithItself
class
ModifySourceCollectionInStream
Identify the backing collection source of a stream and reports if the source is mutated during the stream operations.class
MultipleParallelOrSequentialCalls
class
MultipleUnaryOperatorsInMethodCall
class
NCopiesOfChar
ABugChecker
; see the associatedBugPattern
annotation for details.class
NewFileSystem
ABugChecker
; see the associatedBugPattern
annotation for details.class
NoAllocationChecker
Checks methods annotated with@NoAllocation
to ensure they really do not allocate.class
NonRuntimeAnnotation
class
NullOptional
Flags passing literal null toOptional
-accepting APIs.class
ObjectEqualsForPrimitives
Check for usage ofObjects.equal
on primitive types.class
ObjectsHashCodePrimitive
Check for calls to Objects'Objects.hashCode(java.lang.Object)
with a primitive parameter.class
ObjectToString
Warns against calling toString() on Objects which don't have toString() method overridden and won't produce meaningful output.class
OptionalMapToOptional
MatchesOptional#map
mapping to anotherOptional
.class
OptionalMapUnusedValue
ReplacesOptional.map
withOptional.ifPresent
if the value is unused.class
OptionalOfRedundantMethod
Checks ifOptional#of
is chained with a redundant method.class
OutlineNone
Check for the a11y antipattern of setting CSS outline attributes to none or 0.class
ParameterComment
ABugChecker
; see the associatedBugPattern
annotation for details.class
ParameterName
ABugChecker
; see the associatedBugPattern
annotation for details.class
PreconditionsCheckNotNullRepeated
Checks that Precondition.checkNotNull is not invoked with same arg twice.class
PreconditionsInvalidPlaceholder
class
PrimitiveArrayPassedToVarargsMethod
class
PrimitiveAtomicReference
Discourages inadvertently using reference equality on boxed primitives in AtomicReference.class
PrivateSecurityContractProtoAccess
Check for disallowed access to private_do_not_access_or_else proto fields.class
ProtoBuilderReturnValueIgnored
Highlights cases where a proto's build method has its return value ignored.class
ProtocolBufferOrdinal
Points out if #ordinal() is called on a Protocol Buffer Enum.class
ProtoRedundantSet
Checks that protocol buffers built with chained builders don't set the same field twice.class
ProtoTruthMixedDescriptors
Checks thatProtoTruth
'signoringFields
is passed field numbers from the correct proto.class
RandomCast
ABugChecker
; see the associatedBugPattern
annotation for details.class
ReachabilityFenceUsage
ABugChecker
; see the associatedBugPattern
annotation for details.class
RestrictedApiChecker
Check for non-allowlisted callers to RestrictedApiChecker.class
ReturnValueIgnored
A checker which produces an error when a return value is accidentally discarded.class
RobolectricShadowDirectlyOn
ABugChecker
; see the summary.class
RxReturnValueIgnored
ABugChecker
; see the associatedBugPattern
for details.class
SelfComparison
Points out if an object is compared to itself.class
SelfEquals
class
ShouldHaveEvenArgs
Checks that variable argument methods have even number of arguments.class
StreamToString
ABugChecker
; see the associatedBugPattern
annotation for details.class
StringCaseLocaleUsage
ABugChecker
that flags calls toString.toLowerCase()
andString.toUpperCase()
, as these methods implicitly rely on the environment's default locale.class
StringSplitter
ABugChecker
; see the associatedBugPattern
annotation for details.class
SubstringOfZero
Check for calls to String'sfoo.substring(0)
.class
SymbolToString
Flagscom.sun.tools.javac.code.Symbol#toString
usage inBugChecker
s.class
SystemExitOutsideMain
Check for calls toSystem.exit()
outside of a main method.class
SystemOut
ABugChecker
; see the associatedBugPattern
annotation for details.class
ThreadJoinLoop
class
ThreeLetterTimeZoneID
class
ThrowIfUncheckedKnownChecked
Catches no-op calls toThrowables.throwIfUnchecked
.class
TreeToString
Flagscom.sun.source.tree.Tree#toString
usage inBugChecker
s.class
TruthAssertExpected
Detects usages of Truth assertions with the expected and actual values reversed.class
TruthConstantAsserts
Points out if Truth Library assert is called on a constant.class
TruthGetOrDefault
Flags ambiguous usages ofMap#getOrDefault
withinTruth#assertThat
.class
TruthSelfEquals
Points out if an object is tested for equality/inequality to itself using Truth Libraries.class
TypeEqualsChecker
Flags com.sun.tools.javac.code.Type#equals usage.class
TypeToString
Flagscom.sun.tools.javac.code.Type#toString
usage inBugChecker
s.class
UndefinedEquals
Flags types which do not have well-defined equals behavior.class
UnnecessaryLongToIntConversion
ABugChecker
; see the associatedBugPattern
annotation for details.class
UnnecessaryMethodInvocationMatcher
Matchers.methodInvocation(Matcher)
is not exactly deprecated, but it is legacy, and in particular is not needed when the argument is a MethodMatcher, since MethodMatcher already does the unwrapping that methodInvocation does.class
UnnecessaryOptionalGet
A refactoring to replace Optional.get() with lambda arg in expressions passed as arg to member functions of Optionals.class
UnnecessarySetDefault
ABugChecker
; see the associatedBugPattern
annotation for details.class
UnnecessaryTypeArgument
ABugChecker
; see the associatedBugPattern
annotation for details.class
UnqualifiedYield
ABugChecker
; see the associatedBugPattern
annotation for details.class
UnsafeFinalization
ABugChecker
; see the associatedBugPattern
annotation for details.class
UnsafeLocaleUsage
Flags unsafe usages of theLocale
constructor and class methods.class
UnusedCollectionModifiedInPlace
class
URLEqualsHashCode
Points out on creation of Set and HashMap of type java.net.URL.class
WaitNotInLoop
class
WithSignatureDiscouraged
MethodMatchers.MethodClassMatcher.withSignature(String)
is discouraged: most usages should use .named and/or .withParameters instead.class
YodaCondition
See the summary. -
Uses of BugChecker.MethodInvocationTreeMatcher in com.google.errorprone.bugpatterns.android
Classes in com.google.errorprone.bugpatterns.android that implement BugChecker.MethodInvocationTreeMatcher Modifier and Type Class Description class
BinderIdentityRestoredDangerously
class
IsLoggableTagLength
class
RectIntersectReturnValueIgnored
class
WakelockReleasedDangerously
-
Uses of BugChecker.MethodInvocationTreeMatcher in com.google.errorprone.bugpatterns.argumentselectiondefects
Classes in com.google.errorprone.bugpatterns.argumentselectiondefects that implement BugChecker.MethodInvocationTreeMatcher Modifier and Type Class Description class
ArgumentSelectionDefectChecker
Checks the lexical distance between method parameter names and the argument names at call sites.class
AssertEqualsArgumentOrderChecker
Checker to make sure that assertEquals-like methods are called with the arguments expected and actual the right way round. -
Uses of BugChecker.MethodInvocationTreeMatcher in com.google.errorprone.bugpatterns.collectionincompatibletype
Classes in com.google.errorprone.bugpatterns.collectionincompatibletype that implement BugChecker.MethodInvocationTreeMatcher Modifier and Type Class Description class
CollectionIncompatibleType
Checker for calling Object-accepting methods with types that don't match the type arguments of their container types.class
CollectionUndefinedEquality
Highlights use ofCollection#contains
(and others) with types that do not have well-defined equals.class
IncompatibleArgumentType
class
TruthIncompatibleType
ABugChecker
; see the associatedBugPattern
annotation for details. -
Uses of BugChecker.MethodInvocationTreeMatcher in com.google.errorprone.bugpatterns.flogger
Classes in com.google.errorprone.bugpatterns.flogger that implement BugChecker.MethodInvocationTreeMatcher Modifier and Type Class Description class
FloggerArgumentToString
ABugChecker
; see the associatedBugPattern
annotation for details.class
FloggerFormatString
class
FloggerLogString
Detects invocations ofLoggingApi.log(String)
for which the argument is not a compile-time constant and provides suggested alternatives.class
FloggerLogVarargs
class
FloggerMessageFormat
class
FloggerRequiredModifiers
Ensures that class-level FluentLogger objects are private static final.class
FloggerStringConcatenation
ABugChecker
; see the associatedBugPattern
annotation for details.class
FloggerWithCause
Flogger's withCause(Throwable) method checksclass
FloggerWithoutCause
Detects Flogger log statements that pass Exceptions to the log method instead of using withCause. -
Uses of BugChecker.MethodInvocationTreeMatcher in com.google.errorprone.bugpatterns.formatstring
Classes in com.google.errorprone.bugpatterns.formatstring that implement BugChecker.MethodInvocationTreeMatcher Modifier and Type Class Description class
FormatString
ABugChecker
; see the associatedBugPattern
annotation for details.class
FormatStringAnnotationChecker
BugChecker
to assert validity of methods calls withFormatString
annotations. -
Uses of BugChecker.MethodInvocationTreeMatcher in com.google.errorprone.bugpatterns.inject.dagger
Classes in com.google.errorprone.bugpatterns.inject.dagger that implement BugChecker.MethodInvocationTreeMatcher Modifier and Type Class Description class
RefersToDaggerCodegen
Checks that the only code that refers to Dagger generated code is other Dagger generated code. -
Uses of BugChecker.MethodInvocationTreeMatcher in com.google.errorprone.bugpatterns.inject.guice
Classes in com.google.errorprone.bugpatterns.inject.guice that implement BugChecker.MethodInvocationTreeMatcher Modifier and Type Class Description class
BindingToUnqualifiedCommonType
-
Uses of BugChecker.MethodInvocationTreeMatcher in com.google.errorprone.bugpatterns.inlineme
Classes in com.google.errorprone.bugpatterns.inlineme that implement BugChecker.MethodInvocationTreeMatcher Modifier and Type Class Description class
Inliner
Checker that performs the inlining at call-sites (where the invoked APIs are annotated as@InlineMe
). -
Uses of BugChecker.MethodInvocationTreeMatcher in com.google.errorprone.bugpatterns.nullness
Classes in com.google.errorprone.bugpatterns.nullness that implement BugChecker.MethodInvocationTreeMatcher Modifier and Type Class Description class
NullArgumentForNonNullParameter
ABugChecker
; see the associatedBugPattern
annotation for details.class
ParameterMissingNullable
ABugChecker
; see the associatedBugPattern
annotation for details.class
UnnecessaryCheckNotNull
Checks for unnecessarily performing null checks on expressions which can't be null.class
UnsafeWildcard
Check to detect unsafe upcasts ofnull
values to wildcard types. -
Uses of BugChecker.MethodInvocationTreeMatcher in com.google.errorprone.bugpatterns.threadsafety
Classes in com.google.errorprone.bugpatterns.threadsafety that implement BugChecker.MethodInvocationTreeMatcher Modifier and Type Class Description class
ImmutableChecker
ABugChecker
; see the associatedBugPattern
annotation for details.class
ThreadPriorityCheck
Bug checker to detect usage ofThread.stop()
,Thread.yield()
, and changing thread priorities. -
Uses of BugChecker.MethodInvocationTreeMatcher in com.google.errorprone.bugpatterns.time
Classes in com.google.errorprone.bugpatterns.time that implement BugChecker.MethodInvocationTreeMatcher Modifier and Type Class Description class
DateChecker
Warns against suspect looking calls toDate
APIs.class
DurationFrom
class
DurationGetTemporalUnit
Bans calls toDuration.get(temporalUnit)
wheretemporalUnit
is notSECONDS
orNANOS
.class
DurationTemporalUnit
Bans calls toDuration
APIs where theTemporalUnit
is notChronoUnit.DAYS
or it has an estimated duration (which is guaranteed to throw anDateTimeException
).class
DurationToLongTimeUnit
Reports an error when a Duration or Instant is incorrectly decomposed in order to call an API which accepts a<long, TimeUnit>
pair.class
FromTemporalAccessor
Bans calls tojavaTimeType.from(temporalAmount)
where the call is guaranteed to either: throw aDateTimeException
at runtime (e.g.,LocalDate.from(month)
) return the same parameter (e.g.,Instant.from(instant)
)class
InstantTemporalUnit
Bans calls toInstant
APIs where theTemporalUnit
is not one of:NANOS
,MICROS
,MILLIS
,SECONDS
,MINUTES
,HOURS
,HALF_DAYS
, orDAYS
.class
InvalidJavaTimeConstant
This checker errors on calls tojava.time
methods using values that are guaranteed to throw aDateTimeException
.class
JavaDurationGetSecondsGetNano
This checker warns about calls toduration.getNano()
without a corresponding "nearby" call toduration.getSeconds()
.class
JavaDurationWithNanos
Check for calls toduration.withNanos(int)
.class
JavaDurationWithSeconds
Check for calls toduration.withSeconds(long)
.class
JavaInstantGetSecondsGetNano
This checker warns about calls toinstant.getNano()
without a corresponding "nearby" call toinstant.getEpochSecond()
.class
JavaLocalDateTimeGetNano
This checker warns about calls toLocalDateTime.getNano()
without a corresponding "nearby" call toLocalDateTime.getSecond()
.class
JavaLocalTimeGetNano
This checker warns about calls toLocalTime.getNano()
without a corresponding "nearby" call toLocalTime.getSecond()
.class
JavaPeriodGetDays
This checker warns about calls toperiod.getDays()
without a corresponding "nearby" call toperiod.getYears(), period.getMonths(), or period.getTotalMonths()
.class
JavaTimeDefaultTimeZone
Check for calls tojava.time
APIs that silently use the default system time-zone.class
JodaDurationWithMillis
Check for calls toduration.withMillis(long)
.class
JodaInstantWithMillis
Check for calls toinstant.withMillis(long)
.class
JodaNewPeriod
Match possibly incorrect use of Period to obtain a number of (e.g.) days between two dates.class
JodaPlusMinusLong
Check for calls to JodaTime'stype.plus(long)
andtype.minus(long)
where<type> = {Duration,Instant,DateTime,DateMidnight}
.class
JodaTimeConverterManager
Ban usage of Joda'sConverterManager
.class
JodaToSelf
Check for calls to Joda-Time'sfoo.toFoo()
andnew Foo(foo)
.class
JodaWithDurationAddedLong
Check for calls to JodaTime'stype.withDurationAdded(long, int)
where<type> = {Duration,Instant,DateTime}
.class
LocalDateTemporalAmount
Bans calls toLocalDate.plus(TemporalAmount)
andLocalDate.minus(TemporalAmount)
where theTemporalAmount
is a non-zeroDuration
.class
PeriodFrom
class
PeriodGetTemporalUnit
Bans calls toPeriod.get(temporalUnit)
wheretemporalUnit
is notYEARS
,MONTHS
, orDAYS
.class
PeriodTimeMath
Bans calls toPeriod#plus/minus(TemporalAmount)
where the argument is a Duration.class
PreferJavaTimeOverload
This check suggests the use ofjava.time
-based APIs, when available.class
ProtoDurationGetSecondsGetNano
This checker warns about accessing the underlying nanosecond-adjustment field of a duration without a "nearby" access of the underlying seconds field.class
ProtoTimestampGetSecondsGetNano
This checker warns about accessing the underlying nanosecond-adjustment field of a protobuf timestamp without a "nearby" access of the underlying seconds field.class
TemporalAccessorGetChronoField
Bans calls toTemporalAccessor.get(ChronoField)
where the implementation is guaranteed to throw anUnsupportedTemporalTypeException
.class
TimeUnitConversionChecker
Check for problematic or suspicious TimeUnit conversion calls.class
TimeUnitMismatch
Checker that detects likely time-unit mismatches by looking at identifier names.class
ZoneIdOfZ
This checker bans calls toZoneId.of("Z")
in favor ofZoneOffset.UTC
.