Error Prone 2.0.18 is now available for download from Maven Central.
(There release notes include all changes since 2.0.15.)
New features
Initial release of Refaster, a tool allowing for semantic refactorings of codebases using before-and-after templates. (http://errorprone.info/docs/refaster)
New checks
[FallThrough] undocumented switch case fall through
[MissingDefault] missing default in switches
[UnnecessaryDefaultInEnumSwitch] exhaustive enum switches with an unnecessary default
[ExpectedExceptionChecker] prevents uses of ExpectedException with multiple statements after expect (Issue #219)
[TestExceptionChecker] prevents uses of @Test(expected=...) with multiple statement methods
[URLEqualsHashCode] disallows Set/HashSet/HashMaps of java.net.URL: equals() and hashCode() of java.net.URL class make blocking internet connections
[FragmentInjection] classes extending PreferenceActivity must implement isValidFragment such that it does not unconditionally return true to prevent vulnerability to fragment injection attacks
[LiteByteStringUtf8] prevents silent corruption of certain byte sequences from serialized protocol messages
[IndexOfChar] prevents calling IndexOfChar with the arguments swapped
[ImmutableAnnotationChecker] annotation implementations should always be immutable
[BundleDeserializationCast] checks for type cast compatibility of objects deserialized from android.os.Bundles
[MustBeClosedChecker] ensures that invocations of methods or constructors annotated with @MustBeClosed occur within the resource variable initializer of a try-with-resources statement, or the return statement of another method annotated with @MustBeClosed.
[LiteralClassName] suggest Foo.class rather than Class.forName("Foo") when Foo is available at compile-time
[FloatingPointLiteralPrecision] detect floating point literals that lose precision
[ShortCircuitBoolean] prefer the short-circuiting boolean operators && and || to & and |.
[LoopConditionChecker] check for loops where the condition is never updated in the body.
[MutableConstantField] constant field declarations should use the immutable type (such as ImmutableList) instead of the general collection interface type (such as List)
[TypeParameterShadowing] type parameter declaration overrides another type parameter already declared
[SimpleDateFormatConstant] SimpleDateFormat is not thread-safe, and should not be used as a constant field.
[ThrowNull] `throw null;` always results in a NullPointerException being thrown.
Other changes
Initial implementation of a com.sun.source.util.Plugin (see #535).
Allow suppressing AmbiguousMethodReference on the ambiguous methods instead of the entire class.
Avoid a NullPointerException in FindIdentifiers::inStaticContext (Issue #521)
ReferenceEquality (and others) detect a == b || a.equals(b) and suggest removing the or statement and left-hand side instead of replacing a == b with Objects.equals(a, b);
ImmutableEnumChecker no longer complains about @Immutable on enums that implement an @Immutable interface.
InputStreamSlowMultibyteRead will now ignore streams that just return a compile-time constant, or streams inside JUnit test cases.
EqualsIncompatibleType will report when enums of incompatible types are passed to .equals()
@RestrictedApi now applies to all overriding methods.
Code using ExpectedException no longer triggers @CheckReturnValue errors.
@GuardedBy check now correctly handles fields annotated with `@GuardedBy("itself")`
ScopeOrQualifierAnnotationRetention always checks for SOURCE retention, regardless of whether or not the annotation is in a dagger component.
Update javac dependency to 9-dev-r3297-4 (Issues #375, #507, #522, #534, #529)
Allow calls to @ForOverride methods via 'super' from within overrides to enable standard override chaining use cases (Issue #342)
Unshade dependencies in error_prone_core (Issues #501, #482)
Crash in EqualsIncompatibleType (#547)
Fix immutability analysis of raw types (#549)
Fix handling of `@GuardedBy("itself")` (#541)
Allow suppressing FunctionalInterfaceClash on the methods instead of the entire class