Releases: google/error-prone
Releases · google/error-prone
Error Prone 2.3.0
New checks:
- [ParcelableCreator]: Detects classes which implement Parcelable but don't have CREATOR
- [InconsistentCapitalization] It is confusing to have a field and a parameter under the same scope that differ only in capitalization
- [TruthIncompatibleType] Argument is not compatible with the subject's type
- [ByteBufferBackingArray] ByteBuffer.array() shouldn't be called unless ByteBuffer.arrayOffset() is used or if the ByteBuffer was initialized using ByteBuffer.wrap() or ByteBuffer.allocate()
- [OrphanedFormatString] String literal contains format specifiers, but is not passed to a format method
- [ScopeOnModule] Scopes on modules have no function and will soon be an error
- [CatchAndPrintStackTrace] Logging or rethrowing exceptions should usually be preferred to catching and calling printStackTrace
- [VarTypeName]
var
should not be used as a type name
Other changes:
- Remove MoreAsserts from TryFailThrowable
- Add java.util.Arrays to ReturnValueIgnored check
- Improve BugCheckerRefactoringTestHelper usability
- Extend SizeGreaterThanOrEqualsZero check to check proto repeated fields
- Disallow method references to @DonotCall methods
- Disallow Error Prone BugPattern names that includes spaces.
- Add an optional suffix comment to SuggestedFixes.addSuppressWarnings
- Allow @CompatibleWith to be used on varargs parameters.
- Make StreamResourceLeak a warning
- Recognize null test methods in java.util.Objects in nullness analysis
- Detect more cases of nested and ignored futures.
- Make the failure message in DiagnosticTestHelper easier to read.
- Enable QualifierOrScopeOnInjectMethod as a WARNING
- Consolidate NamedParameters and ParameterName
Fixes issues: #789, #893, #897, #899, #899, #904, #914, #921, #931, #942, #945, #954, #993
Error Prone 2.2.0
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 - 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