Error Prone 2.0.21 is now available for download from Maven Central.
(There release notes include all changes since 2.0.19.)
New features
Added support for passing command-line flags to bug checkers. See errorprone.info/docs/flags#pass-additional-info-to-bugcheckers for details (#524)
Added -XepPatchImportOrder:<order> to control the import order when patchIng. Valid orders are “static-first”, “static-last”, “android-static-first”, and “android-static-last”
Update to javac-9-dev-r4023-2 (#592)
New checks
[ArgumentSelectionDefectChecker] Arguments are in the wrong order or could be commented for clarity
[AssertEqualsArgumentOrderChecker] Arguments are swapped in assertEquals-like call
[AutoValueConstructorOrderChecker] Arguments to AutoValue constructor are in the wrong order
[ComparableAndComparator] Class should not implement both `Comparable` and `Comparator`
[ConstructorInvokesOverridable] Constructors should not invoke overridable methods
[ConstructorLeaksThis] Constructors should not pass the 'this' reference out in method invocations, since the object may not be fully constructed
[InconsistentOverloads] The ordering of parameters in overloaded methods should be as consistent as possible (when viewed from left to right)
[InstanceOfAndCastMatchWrongType] Casting inside an if block should be plausibly consistent with the instanceof type
[IterablePathParameter] Path implements Iterable; prefer Collection for clarity
[JavaLangClash] Never reuse class names from java.lang
[LogicalAssignment] Assignment where a boolean expression was expected; use == if this assignment wasn't expected or add parentheses for clarity
[NamedParameters] Parameter name in argument comment is missing or incorrect
[NCopiesOfChar] The first argument to nCopies is the number of copies, and the second is the item to copy
[NestedInstanceOfConditions] Nested instanceOf conditions of disjoint types create blocks of code that never execute
[OvershadowingSubclassFields] Overshadowing variables of superclass causes confusion and errors
[PredicateIncompatibleType] Using ::equals as an incompatible Predicate; the predicate will always return false
[QualifierOrScopeOnInjectMethod] Qualifiers/Scope annotations on @Inject methods don't have any effect. Move the qualifier annotation to the binding location
[ShouldHaveEvenArgs] This method must be called with an even number of arguments
[UngroupedOverloads] Constructors and methods with the same name should appear sequentially with no other code in between
Bugs fixed
-XepAllDisabledChecksAsWarnings now takes flag position into account (#486)
Recognize safe try/finally/close patterns in MustBeClosedChecker (#489)
Make well-known immutable and unsafe classes for Immutable checkers customizable with new-style command line flags (#512)
Catch uses of Scanner in DefaultCharset (#603)
Avoid subclassing CompilationTask in BaseErrorProneJavaCompiler (#608)
Add second suggested fix to ArgumentSelectionDefectChecker which applies named comments to parameters (#609)
Handle broken classpaths more gracefully in ImmutableAnalysis (#615)
Fix inheritance of @Immutable annotations (#615)
Fix issue where InstanceOfAndCastMatchWrongType was crashing on array accesses (#651)
Changes to existing checks
[ArgumentParameterMismatch, ArgumentParameterSwap] Removed these and replaced with ArgumentSelectionDefectChecker
[CheckReturnValue, FutureReturnValueIgnored, ReturnValueIgnored, PromiseReturnValueIgnored] Handle the case when a function is called in a lambda with a void return type
[ElementsCountedInLoop] Removed this check
[FormatMethod] Add support for constructors
[FutureReturnValueIgnored] Downgrade from ERROR to WARNING
[FutureReturnValueIgnored] Whitelist ChannelFuture#addListener(s)
[GuardedBy] Support all annotations named 'GuardedBy'
[JUnit3TestNotRun] Expand check to find non-public test methods.
[JUnit4TestNotRun] Improve summary message
[LiteralClassName] Downgrade from WARNING to SUGGESTION (#579)
[LogicalAssignment] Downgrade from ERROR to WARNING
[MutableConstantField] Replace declaration type regardless of the original declaration type
[MutableConstantField] Do not suggest a fix when the declaration type is already immutable
[MutableConstantField] Choose the new LHS type according to the original LHS type if possible, otherwise, use the RHS type
[MutableConstantField] Fix references to Multimap and Multiset
[NarrowingCompoundAssignment] Report errors for long-to-int conversions
[ProtocolBufferOrdinal] Check when calling ordinal() on protobuf-lite enums as well as protobuf enums
[ProtocolBufferOrdinal] Upgrade from WARNING to ERROR