Error Prone v2.2.0 Release Notes
Release Date: 2018-01-08 // almost 7 years ago-
๐ New errors:
- [ComparableType] A new check for detecting incompatibility of types between the type of a class implementing
Comparable<T>
andT
. - [ConditionalExpressionNumericPromotion] A conditional expression with numeric second and third operands of differing types may give surprising results.
๐ New warnings:
- โ
[CatchFail] detects tests that ignore exceptions and then call
fail()
- [ModifyCollectionInEnhancedForLoop] detects collections modified within loops.
- [ThreadLocalUsage] ThreadLocals should be stored in static fields.
๐ New optional checks:
- [StringSplit] detects
String.split(String)
, which has surprising behaviour. - ๐จ [StringSplitter] refactors uses of
String.split
toSplitter
. - ๐ [TypeParameterNaming] enforces that type parameters are named according to the google style guide.
- [RandomCast] casting a random number in the range
[0.0, 1.0)
to an integer or long always results in0
.
๐ Changes to existing checks
- ๐ ArrayEquals now detects misuse of
android.support.v4.util.ObjectsCompat#equals
. - ๐ EqualsIncompatibleType now detects misuse of
android.support.v4.util.ObjectsCompat#equals
. - SizeGreaterThanOrEqualsZero now detects misuse of common Android-specific collections.
- FilesLinesLeak was renamed to StreamResourceLeak, and now checks other methods in Files.
- ๐ FunctionalInterfaceClash is no longer enabled by default.
- JUnit4{SetUp,TearDown}NotRun will find methods that look like setup or teardown methods, but have a
@Before
or@After
annotation that are notorg.junit.Before
ororg.junit.After
. - SimpleDateFormatConstant now handles all
DateFormats
, and is renamed to DateFormatConstant - 0๏ธโฃ Disable RestrictToEnforcer by default (fixes #812).
- EqualsIncompatibleType/PredicateIncompatibleType/CollectionIncompatible now explore type parameters to ensure their compatibility:
Foo<A>
is incompatible withFoo<B>
ifA
andB
are incompatible with each-other.
Other changes
- [ComparableType] A new check for detecting incompatibility of types between the type of a class implementing