Skip to content

Releases

Error Prone 2.52.0

Choose a tag to compare

@github-actions github-actions released this 02 Nov 12:32

New checks:

  • AlmostExhaustiveTestParameter: Prefer an exhaustive @TestParameter with an assumption to filter out specific enum values, so newly added enum values are automatically tested (disabled by default).
  • SingleTestParameter: Suggest @TestParameter on the parameter instead of @TestParameters when there is only one test parameter, replacing PreferTestParameter (disabled by default).
  • SingleValueTestParameter: Suggest replacing a @TestParameter that has only a single value with a local variable in the test method (disabled by default).
  • ValueClassEquals: Require non-record concrete value classes to explicitly override equals and hashCode.

Other changes:

  • LoopToTestParameter: Changed severity to SUGGESTION (disabled by default).
  • DistinctVarargsChecker: Allow duplicate arguments to Iterables.concat (#6239) and Mockito argument matchers such as any() (#6240).
  • UnusedVariable: Treat fields accessed via MethodHandles.Lookup (VarHandle/getter/setter lookups) or Atomic*FieldUpdater.newUpdater as used.
  • StringBuilderInitWithChar / StringBuffer refactoring: Refactor StringBuffer to StringBuilder even when used with Matcher.appendReplacement and appendTail (when supported by the target JDK or Android minSdkVersion).
  • CompileTimeConstant: Treat record and interface fields and field accesses on compile-time constants (compileTimeConstant.compileTimeConstantField) as compile-time constants.
  • ValueClassIdentity / ReferenceEquality: Handle JEP 401 value classes.
  • FieldCanBeFinal / ThreadSafety: Improve compile-time performance on large classes and deep type hierarchies, and update SafeRE to 1.1.0 (#6230).
  • Added ClassName for caching resolved ClassSymbol, Type, and binary Name lookups across a compilation.

Closed issues: #5964, #6165, #6230, #6239, #6240, #6275

Full changelog: v2.51.0...v2.52.0

Error Prone 2.51.0

Choose a tag to compare

@github-actions github-actions released this 22 Oct 08:55

New checks:

  • HashCodeInObjectsHash: Detect redundant hashCode() or Objects.hash() calls inside Objects.hash(...), and simplify single-argument Objects.hash(x) calls to Objects.hashCode(x).
  • LoopToTestParameter: Suggest migrating loops in unit tests to TestParameterInjector.
  • MissingJavadoc: Flag public types that are missing Javadoc comments (disabled by default).
  • PreferCharsetOverload: Prefer calling method and constructor overloads that accept a Charset over those that accept a String encoding name.
  • PreferPreconditions: Suggest using Guava's Preconditions instead of explicit if-throw statements for parameter validation (disabled by default).
  • RequireNonNullRefactoring: Refactor explicit if (x == null) { throw new NullPointerException(...); } checks to Objects.requireNonNull (disabled by default).
  • SimplifyTestParameter: Remove redundant explicit value lists on @TestParameter annotations for boolean and Enum types when all values are specified (disabled by default).
  • TraditionalJavadocToMarkdown: Convert traditional /** ... */ Javadoc comments into /// Markdown Javadoc comments (disabled by default).
  • ValueClassIdentity: Flag reliance on identity semantics (such as synchronization, WeakReference, IdentityHashMap, or System.identityHashCode) of value-based classes (disabled by default).

Other changes:

  • CompareToZero: Upgraded from warning to error, and expanded to flag non-relational operations, unary negation, and switch statements/expressions on compareTo and compare results without Integer.signum.
  • IfChainToSwitch: Enabled by default as a warning.
  • UndefinedEquals: Merged ArrayAsKeyOfSetOrMap and CollectionUndefinedEquality into UndefinedEquals (retaining their names as altNames), and generalized detection of types without well-defined equals or hashCode across direct equality, collection containment, and hash-based containers.
  • EqualsIncompatibleType / TruthIncompatibleType: Flag equality comparisons between distinct record types (#6107).
  • ReferenceEquality: Allow == comparisons on private classes whose type hierarchy does not override Object.equals (#5865), private static final sentinel fields, Thread (#5900), and com.sun.source.tree.Tree.
  • PatternMatchingInstanceof: Support while and for loops, parenthesized expressions (#5843), and replacing additional redundant casts when the instanceof already introduces a pattern variable.
  • DistinctVarargsChecker: Expanded to check Objects.hash, CompletableFuture.allOf/anyOf, EnumSet.of, Sets.union/intersection/difference, Stream.concat, Math.min/max, and additional JDK, Guava, Protobuf, Truth, and Mockito methods.
  • MustBeClosedChecker: Require java.lang.foreign.Arena.ofConfined and Arena.ofShared to be closed.
  • ImpossibleNullComparison: Flag null checks on the return value of Class.forName.
  • RestrictedApi / RestrictedInheritance: Added an allowedPaths attribute to allow calls or inheritance from matching file paths without a regular expression.
  • InlineMeInliner: Support substituting type arguments at call sites when inlining generic @InlineMe methods.
  • WellKnownKeep: Recognize Apache Beam DoFn annotations and retain open-source library annotations (Gson, Mockito, Guice, Objectify, TestParameterInjector, AutoFactory).
  • Per-check timing collection is now disabled by default, reducing Error Prone compile-time overhead by ~3–5%; pass -XepPrintTimings to print a timing report after compilation or -XepRecordTimings to record timings programmatically (#6079).
  • CompilationTestHelper now reports all lines with mismatched diagnostic expectations in a single test run rather than failing on the first mismatch (#6116).
  • Replaced the RE2/J dependency with SafeRE.

Closed issues: #4914, #5182, #5843, #5857, #5865, #5878, #5900, #6029, #6079, #6107, #6116, #6133

Full changelog: v2.50.0...v2.51.0

Error Prone 2.50.0

Choose a tag to compare

@github-actions github-actions released this 10 Jun 10:40

New checks:

Closed issues: #5553, #5649, #5778

Full changelog: v2.49.0...v2.50.0

Error Prone 2.49.0

Choose a tag to compare

@github-actions github-actions released this 07 Apr 10:59

This release includes several changes to Matcher APIs, and removed some deprecated or problematic APIs:

  • Remove deprecated MethodMatchers.withSignature API, which relies on fragile toString behaviour. Alternatives for matching on method signatures with varargs and type parameters were added in a98a1c5.
  • Removed variableType(Matcher) API. Matchers.variableType(Matcher) uses VariableTree#getType to match variable types, which own't work for lambda parameters with inferred types after JDK-8268850. The recommended replacement is variableType(TypePredicate).
  • Make enclosingPackage return an optional. Module elements are not enclosed by a package, checks using enclosingPackage shouldn't assume an enclosing package exists when processing arbitrary elements.
  • New FieldMatchers API, similar to MethodMatchers (1dd9c3a).

New checks:

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

Choose a tag to compare

@github-actions github-actions released this 27 Feb 13:26

Changes:

  • Added support for passing flags with command-line argument files (@-files) (8e84edf)

New checks:

Closed issues: #5529, #5537, #5522, #5521

Full changelog: v2.47.0...v2.48.0

Error Prone 2.47.0

Choose a tag to compare

@github-actions github-actions released this 05 Feb 08:59

New checks:

Closed issues: #1811, #4168, #5459, #5460

Full changelog: v2.46.0...v2.47.0

Error Prone 2.46.0

Choose a tag to compare

@cushon cushon released this 08 Jan 14:44

Changes:

New checks:

Full changelog: v2.45.0...v2.46.0

Error Prone 2.45.0

Choose a tag to compare

@github-actions github-actions released this 27 Nov 15:54

Changes:

  • Improved compatibility with latest JDK 26 EA builds.

New checks:

Closed issues: #5335

Full changelog: v2.44.0...v2.45.0

Error Prone 2.44.0

Choose a tag to compare

@github-actions github-actions released this 07 Nov 12:06

Changes

Closed issues: #5218, #5278

Full changelog: v2.43.0...v2.44.0

Error Prone 2.43.0

Choose a tag to compare

@github-actions github-actions released this 22 Oct 14:20

The minimum supported JDK version to run Error Prone is now JDK 21 (#4867).

Changes:

  • -XepPatchChecks now skips disabled checks (#4943)
  • AndroidJdkLibsChecker has been removed, the recommended replacement for Android code is Android Lint's NewApi check

New checks:

Closed issues: #4943, #5102, #5107, #5121, #5158, #5217, #5239

Full changelog: v2.42.0...v2.43.0