Skip to content

Latest commit

 

History

History
51 lines (46 loc) · 6.45 KB

ErrorProne.md

File metadata and controls

51 lines (46 loc) · 6.45 KB

Error Prone inspections

Error Prone is a static analysis tool that can catch potential bugs at compile time. Given that it increases compile times (especially so on bigger projects), it is generally not enabled locally (only in CI). To avoid waiting until this is flagged after a developer has pushed their changes, this document lists the (roughly) equivalent IntelliJ inspections for each Error Prone bug pattern.

On by default (ERROR)

Bug Pattern Inspection
ArrayEquals Array comparison using '==' instead of 'Arrays.equals'
'equals()' called on Array
'Objects.equals()' called on arrays'
ArrayHashCode 'hashCode()' called on array
ArrayToString Call to 'toString()' on array
BadShiftAmount Shift operation by inappropriate context
CheckReturnValue Result of method call ignored
CollectionIncompatibleType Suspicious collections method calls
ComplexBooleanConstant Pointless boolean expression
ConstantOverflow Integer multiplication or shift implicitly cast
DepAnn Missing @Deprecated annotation
EqualsIncompatibleType 'equals()' between objects of inconvertible types
EqualsNaN Comparison to Double.NaN or Float.NaN
FormatString Malformed format string
GetClassOnClass Class.getClass() call
GuardedBy Unguarded field access
Immutable Non-final field in @Immutable class
InfiniteRecursion Infinite recursion
InvalidPatternSyntax Malformed regular expression
Junit4ClassAnnotationNonStatic Malformed @BeforeClass/@BeforeAll or @AfterClass/@AfterAll method
Junit4SetUpNotRun Malformed @Before or @After method
Malformed 'setUp()' or 'tearDown()' method
Junit4TearDownNotRun Malformed @Before or @After method
Malformed 'setUp()' or 'tearDown()' method
LoopConditionChecker Loop variable not updated inside loop
MissingOverride Missing @Override annotation
MissingSuperCall Method does not call super method
MustBeClosedChecker AutoCloseable used without 'try-with-resources'
MoreThanOneInjectableConstructor Multiple @Inject constructors for class
PreconditionsCheckNotNull Null-check method is called with obviously non-null argument
PreconditionsCheckNotNullPrimitive Null-check method is called with obviously non-null argument
RandomCast 'Math.random()' cast to 'int'
RemoveUnusedImports Unused import
SelfAssignment Variable is assigned to itself
SizeGreaterThanOrEqualsZero 'size() == 0' replaceable with 'isEmpty()'
StreamToString Call to default 'toString()'
StringBuilderInitWithChar StringBuilder constructor call with 'char' argument
ThrowNull 'null' thrown

This table can be aligned in Vim with :EasyAlign*|