Error Prone 2.1.2 is now available for download from Maven Central.
New error checks:
* [ArrayFillIncompatibleType] Check to see if Arrays.fill(Object[], Object) is called with incompatible types, e.g., storing Integer into a String[].
* [DeadThread] Check for threads that are created and never used.
New warning checks:
* [CanonicalDuration] Canonicalize Durations, e.g. Duration.ofDays(1) instead of Duration.ofSeconds(86400)
* [JdkObsolete] Discourage the use of obsolete JDK classes.
* [ParameterName] Ensure /* name= */-style parameter comments match the corresponding formal parameter name
* [ProvidesFix] Ensure the new providesFix field in @BugPattern is correctly populated
* [UseCorrectAssertInTests] Detect usage of Java assert in test methods and provide suggested fix to replace occurrences with Truth test assertions
Other changes:
* Add providesFix field to @BugPattern to document whether BugCheckers provide suggested fixes, validated with ProvidesFix checker
* Add -XepCompilingTestOnlyCode to ErrorProneOptions, so BugCheckers can decide if they want to behave differently in test-only code
* Remove [LiteralClassName] - many of the occurrences of this pattern are deliberately avoiding a compile-time dependency on a class that may not be present at runtime, and the work-around of handling a LinkageError is bad practice
* Format test inputs in BugCheckerRefactoringTestHelper so TEXT_MATCH tests ignore whitespace
* Report better failure messages in CompilationTestHelpers
* Allow @LazyInit to be used as a suppression mechanism for SynchronizeOnNonFinalField
* FormatStringAnnotation checks no longer apply when the @FormatMethod method is mocked with Mockito and the method is passed Mockito matchers
* Add java.nio.file.Path to the list of well known immutable types
* Don't run ConstructorLeaksThis in unit tests
* Allow long non-file arguments to be spilled (#671)
* Fix a crash in IncrementInForLoopAndHeader (#711)
* Don't warn for methods that are overriding super-methods in InconsistentOverloads (#718)
* Handle @SuppressWarnings on members in ConstructorLeaksThis (#735)
* Handle non-array types (e.g. null) in CollectionToArraySafeParameter (#733)
* Fix NullPointerException in OptionalNotPresent checker (#738)
* Update Gradle example to latest version (#753)