We are pleased to announce the release of Error Prone 2.0.13.
Checks now enabled by default:
GuiceAssistedParameters: a constructor cannot have two @Assisted parameters of
the same type unless they are disambiguated with named @Assisted annotations
ModifyingCollectionWithItself: using a collection function with itself as the
argument
ProvidesMethodOutsideOfModule: @Provides methods need to be declared in a
Module to have any effect
New experimental checks:
QualifierWithTypeUse, to flag instances where Qualifier annotations are declared as eligible for use in TYPE_USE or TYPE_PARAMETER contexts.
BindingToUnqualifiedCommonType check, for when primitives (int, String, BigDecimal, etc.) are bound without a Qualifier annotation
MultibindsInsteadOfMultibindings: check/refactoring for Dagger 2 that suggests using @Multibinds methods instead of @Multibindings interfaces.
Other changes:
Fix NoClassDefFoundError for Error Prone classes used by plugins.
Improve DefaultCharset fix for FileWriters
Improve ConstantOverflow fix, don't suggest making int literals longs if the enclosing expression already promotes them to long
Update JavaxInjectOnAbstractMethod to call out @Inject on interface default methods
Restrict ScopeOrQualifierAnnotationRetention to non-Android builds, as dependency injection frameworks used on Android (e.g. Dagger) tend to be compile-time, and are thus practically unaffected by the change. It is still incorrect to have @Scope/@Qualifier without runtime retention by spec, but this prevents warnings in circumstances we know to be OK.
Consider Dagger @ProductionComponent and @ProductionSubcomponent as dagger components for exceptions to MoreThanOneScopeAnnotationOnClass
Add java.util.regex.Pattern and java.util.Optional to the list of well-known immutable types, fixes #454.
Update the suggested fixes of ModifyingCollectionWithItself to more accurately target valid replacements, and detect addAll(int, Collection) as well.
Adjust AssistedParameters to not suggest the deletion of parameters, and also give a breakdown of @Assisted parameter conflicts that occur
CheckReturnValue will ignore a statement if it's the last statement in a block that's immediately passed to a JUnit Assert.assertThrows() or Assert.expectThrows()
AssistedInjectAndInjectOnConstructors no longer suggests the deletion of annotations.
BoxedPrimitiveConstructor now suggests Float.valueOf((float) Double) as opposed to Float.valueOf(Double), which is uncastable to the valid options of double or String.