Uses of Interface
com.google.errorprone.bugpatterns.BugChecker.MethodInvocationTreeMatcher
Package
Description
Checks added to the java compiler which detect common bug patterns.
Bug patterns related to Dagger.
Bug patterns related to Guice.
-
Uses of BugChecker.MethodInvocationTreeMatcher in com.google.errorprone.bugpatterns
Modifier and TypeClassDescriptionclass
Check for usage ofSet<T>
orMap<T, E>
.class
AbstractMockChecker<T extends Annotation>
Helper for enforcing Annotations that disallow mocking.class
Finds calls to regex-accepting methods with literal strings.class
An abstract base class to match API usages in which the return value is not used.class
An abstract matcher for implicit and explicit calls toObject.toString()
, for use on types that do not have a human-readabletoString()
implementation.final class
ABugChecker
; see the associatedBugPattern
annotation for details.class
ABugChecker
; see the associatedBugPattern
annotation for details.final class
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
ABugChecker
; see the associatedBugPattern
annotation for details.class
ABugChecker
; see the associatedBugPattern
annotation for details.class
Warns that users should not have an array as a key to a Set or Mapclass
class
Checks when Arrays.fill(Object[], Object) is called with object types that are guaranteed to result in an ArrayStoreException.class
class
class
class
ABugChecker
; see the associatedBugPattern
annotation for details.class
ABugChecker
; see the associatedBugPattern
annotation for details.class
A BugPattern; see the summaryfinal class
ABugChecker
that detects use of the unsafe JNDI API system.final class
ABugChecker
that detects use of the unsafe JNDI API system.final class
ABugChecker
that detects use of the unsafeSerializable
API.class
A BugChecker; see the associated BugPattern for details.final class
Matches use ofBigDecimal#equals
, which compares scale as well (which is not likely to be intended).class
ABugChecker
; see the associatedBugPattern
annotation for details.class
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
Bug pattern to recognize attempts to mock final types.final class
A BugPattern; see the summaryclass
ABugChecker
; see the associatedBugPattern
annotation for details.final class
Identifies calls toassertThat
and similar methods inside the implementation of aSubject
assertion method.final class
Checks, if two constructors in a class both acceptFoo foo
and one calls the other, that the caller passesfoo
as a parameter.class
Checks for use of Character.getNumericValue and UCharacter.getNumericValueclass
class
ABugChecker
; see the associatedBugPattern
annotation for details.class
class
final class
Suggests comparing the result ofcompareTo
to only0
.class
A Bugpattern; see the accompanying Markdown documentation.final class
Flags ambiguous creations of objects inMap.computeIfAbsent(K, java.util.function.Function<? super K, ? extends V>)
.class
ABugChecker
; see the associatedBugPattern
annotation for details.class
ABugChecker
; see the associatedBugPattern
annotation for details.final class
ErrorProne checker to generate warning when method expecting distinct varargs is invoked with same variable argument.final class
Suggests not mocking AutoValue classes.class
Points out if a Mockito or EasyMock mock is mocking an object that would be better off being tested using an alternative instance.final class
Flag DateFormats which use the same field more than once.class
Flags duplicate keys used in ImmutableMap construction.final class
Discourages the use ofEnum.ordinal()
and other ways to access enum values by index.final class
Discourages the use ofObject.getClass()
when implementingObject.equals(Object)
for non-final classes.class
final class
ABugChecker
; see the associatedBugPattern
annotation for details.final class
Discourages implementingequals
usinghashCode
.final class
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
Verifies that methods markedForOverride
are only called from the defining class.final class
See BugPattern annotation.final class
Checks for calls to Guava'sFutures.getChecked
method that will always fail because they pass an incompatible exception type.final class
See summary for details.class
class
ABugChecker
; see the associatedBugPattern
annotation for details.class
class
ABugChecker
; see the associatedBugPattern
annotation for details.final class
ABugChecker
; see the associatedBugPattern
annotation for details.class
ABugChecker
; see the associatedBugPattern
annotation for details.class
ABugChecker
; see the associatedBugPattern
annotation for details.class
ABugChecker
; see the associatedBugPattern
annotation for details.class
ABugChecker
; see the associatedBugPattern
annotation for details.final class
Flags ignored return values from pure getters.class
ABugChecker
; see the associatedBugPattern
annotation for details.class
ABugChecker
; see the associatedBugPattern
annotation for details.class
class
ABugChecker
; see the associatedBugPattern
annotation for details.class
class
class
Validates ZoneId.final class
class
ABugChecker
; see the associatedBugPattern
annotation for details.class
ABugChecker
; see the associatedBugPattern
annotation for details.class
Detects floating-point assertEquals() calls that will not work in JUnit 4.class
class
Points out if an object is tested for reference equality to itself using JUnit library.final class
A BugPattern; see the summary.class
class
Points out if #valueOf() is called on a Protocol Buffer Enum.final class
Flags calls totoString
on lite protos.final class
Suggests that calls toLock.lock
must be immediately followed by atry-finally
that callsLock.unlock
.class
Detects locks on boxed primitives.final class
ABugChecker
; see the associatedBugPattern
annotation for details.class
ABugChecker
; see the associatedBugPattern
annotation for details.class
Checker to prevent usages of comparison methods where both the operands undergo lossy widening.final class
final class
Check for calls to Math'sMath.round(float)
with an integer or long parameter.final class
See the summary.class
Base class for checks which find common errors in date format patterns.final class
Ban use of D (day-of-year) in a date format pattern that also contains M (month-of-year).final class
Ban use of YYYY in a SimpleDateFormat pattern, unless it is being used for a week date.final class
Checks for calls toDescriptor#findFieldByNumber
with field numbers from a different proto.class
ABugChecker
; see the associatedBugPattern
annotation for details.class
class
class
Identify the backing collection source of a stream and reports if the source is mutated during the stream operations.final class
A BugPattern; see the summary.class
class
final class
Warns on classes or methods being named similarly to contextual keywords, or invoking such methods.class
ABugChecker
; see the associatedBugPattern
annotation for details.class
ABugChecker
; see the associatedBugPattern
annotation for details.class
Checks methods annotated with@NoAllocation
to ensure they really do not allocate.class
final class
Flags passing literal null toOptional
-accepting APIs.class
Check for usage ofObjects.equal
on primitive types.final class
Check for calls to Objects'Objects.hashCode(java.lang.Object)
with a primitive parameter.class
Warns against calling toString() on Objects which don't have toString() method overridden and won't produce meaningful output.final class
MatchesOptional#map
mapping to anotherOptional
.final class
ReplacesOptional.map
withOptional.ifPresent
if the value is unused.class
Checks ifOptional#of
is chained with a redundant method.class
Check for the a11y antipattern of setting CSS outline attributes to none or 0.class
ABugChecker
; see the associatedBugPattern
annotation for details.class
ABugChecker
; see the associatedBugPattern
annotation for details.class
Checks that Precondition.checkNotNull is not invoked with same arg twice.class
class
final class
Discourages inadvertently using reference equality on boxed primitives in AtomicReference.class
Check for disallowed access to private_do_not_access_or_else proto fields.final class
Highlights cases where a proto's build method has its return value ignored.class
Points out if #ordinal() is called on a Protocol Buffer Enum.final class
Checks thatProtoTruth
'signoringFields
is passed field numbers from the correct proto.class
ABugChecker
; see the associatedBugPattern
annotation for details.class
ABugChecker
; see the associatedBugPattern
annotation for details.final class
A BugPattern; see the summary.class
Check for non-allowlisted callers to RestrictedApiChecker.class
A checker which produces an error when a return value is accidentally discarded.class
ABugChecker
; see the summary.final class
ABugChecker
; see the associatedBugPattern
for details.final class
ABugPattern
; see the summary.class
Points out if an object is compared to itself.class
final class
A BugPattern; see the summary.class
Checks that variable argument methods have even number of arguments.class
ABugChecker
; see the associatedBugPattern
annotation for details.final class
ABugChecker
that flags calls toString.toLowerCase()
andString.toUpperCase()
, as these methods implicitly rely on the environment's default locale.class
ABugChecker
; see the associatedBugPattern
annotation for details.final class
ABugChecker
; see the associatedBugPattern
annotation for details.class
ABugChecker
; see the associatedBugPattern
annotation for details.final class
Check for calls to String'sfoo.substring(0)
.class
ABugChecker
; see the associatedBugPattern
annotation for details.class
Flagsjavax.lang.model.element.Element#toString
usage inBugChecker
s.class
ABugChecker
; see the associatedBugPattern
annotation for details.class
Check for calls toSystem.exit()
outside of a main method.class
ABugChecker
; see the associatedBugPattern
annotation for details.class
class
class
A BugPattern; see the summary.class
A BugPattern; see the summary.class
Flagscom.sun.source.tree.Tree#toString
usage inBugChecker
s.final class
Detects usages of Truth assertions with the expected and actual values reversed.class
Points out if Truth Library assert is called on a constant.final class
ABugChecker
; see the associatedBugPattern
annotation for details.final class
Flags ambiguous usages ofMap#getOrDefault
withinTruth#assertThat
.class
Flags com.sun.tools.javac.code.Type#equals usage.class
Flagsjavax.lang.model.type.TypeMirror#toString
usage inBugChecker
s.final class
Flags types which do not have well-defined equals behavior.class
ABugChecker
; see the associatedBugPattern
annotation for details.class
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.final class
A refactoring to replace Optional.get() with lambda arg in expressions passed as arg to member functions of Optionals.class
ABugChecker
; see the associatedBugPattern
annotation for details.class
ABugChecker
; see the associatedBugPattern
annotation for details.class
ABugChecker
; see the associatedBugPattern
annotation for details.final class
Flags unsafe usages of theLocale
constructor and class methods.class
class
Points out on creation of Set and HashMap of type java.net.URL.class
class
MethodMatchers.MethodClassMatcher.withSignature(String)
is discouraged: most usages should use .named and/or .withParameters instead.final class
See the summary. -
Uses of BugChecker.MethodInvocationTreeMatcher in com.google.errorprone.bugpatterns.android
Modifier and TypeClassDescriptionclass
class
final class
class
-
Uses of BugChecker.MethodInvocationTreeMatcher in com.google.errorprone.bugpatterns.argumentselectiondefects
Modifier and TypeClassDescriptionclass
Checks the lexical distance between method parameter names and the argument names at call sites.final class
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
Modifier and TypeClassDescriptionclass
Checker for calling Object-accepting methods with types that don't match the type arguments of their container types.final class
Highlights use ofCollection#contains
(and others) with types that do not have well-defined equals.class
final class
ABugChecker
; see the associatedBugPattern
annotation for details.class
ABugChecker
; see the associatedBugPattern
annotation for details. -
Uses of BugChecker.MethodInvocationTreeMatcher in com.google.errorprone.bugpatterns.flogger
Modifier and TypeClassDescriptionclass
ABugChecker
; see the associatedBugPattern
annotation for details.class
class
Detects invocations ofLoggingApi.log(String)
for which the argument is not a compile-time constant and provides suggested alternatives.final class
class
final class
Ensures that class-level FluentLogger objects are private static final.class
ABugChecker
; see the associatedBugPattern
annotation for details.class
Flogger's withCause(Throwable) method checksclass
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
Modifier and TypeClassDescriptionclass
ABugChecker
; see the associatedBugPattern
annotation for details.final class
BugChecker
to assert validity of methods calls withFormatString
annotations. -
Uses of BugChecker.MethodInvocationTreeMatcher in com.google.errorprone.bugpatterns.inject.dagger
Modifier and TypeClassDescriptionfinal class
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
-
Uses of BugChecker.MethodInvocationTreeMatcher in com.google.errorprone.bugpatterns.inlineme
Modifier and TypeClassDescriptionfinal class
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
Modifier and TypeClassDescriptionfinal class
ABugChecker
; see the associatedBugPattern
annotation for details.final class
ABugChecker
; see the associatedBugPattern
annotation for details.class
Checks for unnecessarily performing null checks on expressions which can't be null.class
Check to detect unsafe upcasts ofnull
values to wildcard types. -
Uses of BugChecker.MethodInvocationTreeMatcher in com.google.errorprone.bugpatterns.threadsafety
Modifier and TypeClassDescriptionclass
ABugChecker
; see the associatedBugPattern
annotation for details.class
Bug checker to detect usage ofThread.stop()
,Thread.yield()
, and changing thread priorities.class
ABugChecker
; see the associatedBugPattern
annotation for details. -
Uses of BugChecker.MethodInvocationTreeMatcher in com.google.errorprone.bugpatterns.time
Modifier and TypeClassDescriptionfinal class
Warns against suspect looking calls toDate
APIs.final class
final class
Bans calls toDuration.get(temporalUnit)
wheretemporalUnit
is notSECONDS
orNANOS
.final class
Bans calls toDuration
APIs where theTemporalUnit
is notChronoUnit.DAYS
or it has an estimated duration (which is guaranteed to throw anDateTimeException
).final class
Reports an error when a Duration or Instant is incorrectly decomposed in order to call an API which accepts a<long, TimeUnit>
pair.final class
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)
)final class
Bans calls toInstant
APIs where theTemporalUnit
is not one of:NANOS
,MICROS
,MILLIS
,SECONDS
,MINUTES
,HOURS
,HALF_DAYS
, orDAYS
.final class
This checker errors on calls tojava.time
methods using values that are guaranteed to throw aDateTimeException
.final class
This checker warns about calls toduration.getNano()
without a corresponding "nearby" call toduration.getSeconds()
.final class
Error prone checking forDuration.getSeconds()
withoutDuration.getNano()
.final class
Check for calls toduration.withNanos(int)
.final class
Check for calls toduration.withSeconds(long)
.final class
This checker warns about calls toinstant.getNano()
without a corresponding "nearby" call toinstant.getEpochSecond()
.final class
This checker warns about calls toLocalDateTime.getNano()
without a corresponding "nearby" call toLocalDateTime.getSecond()
.final class
This checker warns about calls toLocalTime.getNano()
without a corresponding "nearby" call toLocalTime.getSecond()
.final class
This checker warns about calls toperiod.getDays()
without a corresponding "nearby" call toperiod.getYears(), period.getMonths(), or period.getTotalMonths()
.final class
Check for calls tojava.time
APIs that silently use the default system time-zone.final class
Check for calls toduration.withMillis(long)
.final class
Check for calls toinstant.withMillis(long)
.final class
Match possibly incorrect use of Period to obtain a number of (e.g.) days between two dates.final class
Check for calls to JodaTime'stype.plus(long)
andtype.minus(long)
where<type> = {Duration,Instant,DateTime,DateMidnight}
.final class
Ban usage of Joda'sConverterManager
.final class
Check for calls to Joda-Time'sfoo.toFoo()
andnew Foo(foo)
.final class
Check for calls to JodaTime'stype.withDurationAdded(long, int)
where<type> = {Duration,Instant,DateTime}
.final class
Bans calls toLocalDate.plus(TemporalAmount)
andLocalDate.minus(TemporalAmount)
where theTemporalAmount
is a non-zeroDuration
.final class
final class
Bans calls toPeriod.get(temporalUnit)
wheretemporalUnit
is notYEARS
,MONTHS
, orDAYS
.final class
Bans calls toPeriod#plus/minus(TemporalAmount)
where the argument is a Duration.final class
This check suggests the use ofjava.time
-based APIs, when available.final class
This checker warns about accessing the underlying nanosecond-adjustment field of a duration without a "nearby" access of the underlying seconds field.final class
This checker warns about accessing the underlying nanosecond-adjustment field of a protobuf timestamp without a "nearby" access of the underlying seconds field.final class
Bans calls toTemporalAccessor.get(ChronoField)
where the implementation is guaranteed to throw anUnsupportedTemporalTypeException
.final class
Check for problematic or suspicious TimeUnit conversion calls.final class
Checker that detects likely time-unit mismatches by looking at identifier names.final class
This checker bans calls toZoneId.of("Z")
in favor ofZoneOffset.UTC
.