Releases · google/error-prone (original) (raw)
Error Prone 2.50.0
New checks:
- BoxingComparator: Detect implicitly-boxing Comparator.comparing key extractors
- ExposedPrivateType: Discourage references to private member classes from non-private APIs
- JUnitMethodInvoked: Discourage directly invoking JUnit test methods
- ListRemoveAmbiguous: Detect ambiguous calls to
List.remove(int|Integer) - PreferTestParameter: suggests using
@TestParameterinstead of@TestParametersfor exhaustive boolean and enum parameters on single-element parameterized tests - RecordComponentAccessorAnnotationConflict: Detect conflicts between record components and explicit accessor methods
- RecordComponentOverride: Discourage
@Overrideon record component declarations that don't override
anything - ThrowableEqualsHashCode: Discourage overriding
Throwable.equals()andhashCode()
Closed issues: #5553, #5649, #5778
Full changelog: v2.49.0...v2.50.0
Error Prone 2.49.0
This release includes several changes to Matcher APIs, and removed some deprecated or problematic APIs:
- Remove deprecated
MethodMatchers.withSignatureAPI, which relies on fragiletoStringbehaviour. Alternatives for matching on method signatures with varargs and type parameters were added in a98a1c5. - Removed
variableType(Matcher)API.Matchers.variableType(Matcher)usesVariableTree#getTypeto match variable types, which own't work for lambda parameters with inferred types after JDK-8268850. The recommended replacement isvariableType(TypePredicate). - Make
enclosingPackagereturn an optional. Module elements are not enclosed by a package, checks usingenclosingPackageshouldn't assume an enclosing package exists when processing arbitrary elements. - New
FieldMatchersAPI, similar toMethodMatchers(1dd9c3a).
New checks:
- AssertThrowsBlockToExpression: Discourage unnecessary block lambdas in
assertThrows. - AssertThrowsMinimizer: Suggest minimizing the amount of logic in
assertThrows. - MemorySegmentReferenceEquality: Discourage using reference equality for
MemorySegments. - PreferThrowsTag: Recommends using
@throwsinstead of the legacy@exceptionjavadoc tag. - RecordAccessorInCompactConstructor: detect record accessors inside the compact canonical ctors, which read uninitialized fields.
Closed issues: #2283, #3503, #5210, #5289, #5548, #5548, #5554, #5609, #5614, #5656
Full changelog: v2.48.0...v2.49.0
Error Prone 2.48.0
Error Prone 2.47.0
Error Prone 2.46.0
Changes:
- The javac flag
-XDaddTypeAnnotationsToSymbol=trueis now required for Error Prone invocations on JDK 21, to enable the javac fix for JDK-8225377: type annotations are not visible to javac plugins across compilation boundaries. See #5426 for details. - Remove deprecated
valueattribute from@IncompatibleModifiersand@RequiredModifiers(#2122) - Error Prone API changes to encapsulate references to internal javac APIs for end position handling (
EndPosTable,DiagnosticPosition) (5440bb4, 06c2905, f3915ec)
New checks:
- DuplicateAssertion: detect duplicated assertion lines where the argument to
assertThatis pure - IfChainToSwitch: suggest converting chains of if-statements into arrow switches
- ScannerUseDelimiter: discourage
Scanner.useDelimiter("\\A") - AddNullMarkedToClass: refactoring to add
@NullMarkedannotation to top level classes
Full changelog: v2.45.0...v2.46.0
Error Prone 2.45.0
Changes:
- Improved compatibility with latest JDK 26 EA builds.
New checks:
- AssertSameIncompatible: Detect calls to
assertSameand similar assertions, where the calls are guaranteed to either succeed or fail. - FormatStringShouldUsePlaceholders: Suggests using a format string instead of string concatenation operations on format methods
Closed issues: #5335
Full changelog: v2.44.0...v2.45.0
Error Prone 2.44.0
Error Prone 2.43.0
The minimum supported JDK version to run Error Prone is now JDK 21 (#4867).
Changes:
-XepPatchChecksnow skips disabled checks (#4943)AndroidJdkLibsCheckerhas been removed, the recommended replacement for Android code is Android Lint's NewApi check
New checks:
- NullNeedsCastForVarargs: Detect calls that incorrectly passes a
nullarray instead of anullelement. - RedundantNullCheck: detect checks on expressions that are non-null.
Closed issues: #4943, #5102, #5107, #5121, #5158, #5217, #5239
Full changelog: v2.42.0...v2.43.0
Error Prone 2.42.0
New checks:
- ExplicitArrayForVarargs: discourage unnecessary explicit construction of an array to provide varargs.
- FloggerPerWithoutRateLimit: discourage Flogger's
perUniquewithout rate limiting - StringJoin: Ban
String.join(CharSequence)andString.join(CharSequence, CharSequence) - ThreadBuilderNameWithPlaceholder: Do not allow placeholders in
Thread.Builder.name(String)orname(String, int).
Changes:
- The return type of
ASTHelpers.asFlagSethas changed. The previous type wasEnumSet<Flags.Flag>, whereFlags.Flagis an enum in the javac classFlags. A recent JDK change has replaced that enum with a new top-level enum calledFlagsEnum. It is not possible to changeASTHelpers.asFlagSetin a way that would be type-safe and compatible with the enums from JDKs both before and after the change. Instead, the method now returnsImmutableSet<String>, where the strings come from thetoString()of the enum constants. That means they are"native","abstract", etc. - Flag
IO.print[ln]()in SystemOut.
Full changelog: v2.41.0...v2.42.0
Error Prone 2.41.0
New checks:
- EffectivelyPrivate: Detect declarations that have
publicorprotectedmodifiers, but are effectively private
Changes:
- Skip BooleanLiteral findings if the target type is boxed (#5134)
Full changelog: v2.40.0...v2.41.0