Skip to content

Commit ffabc10

Browse files
chore(deps): update dependency com.google.errorprone:error_prone_core to v2.51.0 (#2597)
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [com.google.errorprone:error_prone_core](https://errorprone.info) ([source](https://redirect.github.com/google/error-prone)) | `2.50.0` → `2.51.0` | ![age](https://developer.mend.io/api/mc/badges/age/maven/com.google.errorprone:error_prone_core/2.51.0?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/com.google.errorprone:error_prone_core/2.50.0/2.51.0?slim=true) | --- ### Release Notes <details> <summary>google/error-prone (com.google.errorprone:error_prone_core)</summary> ### [`v2.51.0`](https://redirect.github.com/google/error-prone/releases/tag/v2.51.0): Error Prone 2.51.0 [Compare Source](https://redirect.github.com/google/error-prone/compare/v2.50.0...v2.51.0) New checks: - [`HashCodeInObjectsHash`](https://errorprone.info/bugpattern/HashCodeInObjectsHash): Detect redundant `hashCode()` or `Objects.hash()` calls inside `Objects.hash(...)`, and simplify single-argument `Objects.hash(x)` calls to `Objects.hashCode(x)`. - [`LoopToTestParameter`](https://errorprone.info/bugpattern/LoopToTestParameter): Suggest migrating loops in unit tests to `TestParameterInjector`. - [`MissingJavadoc`](https://errorprone.info/bugpattern/MissingJavadoc): Flag public types that are missing Javadoc comments (disabled by default). - [`PreferCharsetOverload`](https://errorprone.info/bugpattern/PreferCharsetOverload): Prefer calling method and constructor overloads that accept a `Charset` over those that accept a `String` encoding name. - [`PreferPreconditions`](https://errorprone.info/bugpattern/PreferPreconditions): Suggest using Guava's `Preconditions` instead of explicit `if`-`throw` statements for parameter validation (disabled by default). - [`RequireNonNullRefactoring`](https://errorprone.info/bugpattern/RequireNonNullRefactoring): Refactor explicit `if (x == null) { throw new NullPointerException(...); }` checks to `Objects.requireNonNull` (disabled by default). - [`SimplifyTestParameter`](https://errorprone.info/bugpattern/SimplifyTestParameter): Remove redundant explicit value lists on `@TestParameter` annotations for `boolean` and `Enum` types when all values are specified (disabled by default). - [`TraditionalJavadocToMarkdown`](https://errorprone.info/bugpattern/TraditionalJavadocToMarkdown): Convert traditional `/** ... */` Javadoc comments into `///` Markdown Javadoc comments (disabled by default). - [`ValueClassIdentity`](https://errorprone.info/bugpattern/ValueClassIdentity): Flag reliance on identity semantics (such as synchronization, `WeakReference`, `IdentityHashMap`, or `System.identityHashCode`) of value-based classes (disabled by default). Other changes: - [`CompareToZero`](https://errorprone.info/bugpattern/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`](https://errorprone.info/bugpattern/IfChainToSwitch): Enabled by default as a warning. - [`UndefinedEquals`](https://errorprone.info/bugpattern/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`](https://errorprone.info/bugpattern/EqualsIncompatibleType) / [`TruthIncompatibleType`](https://errorprone.info/bugpattern/TruthIncompatibleType): Flag equality comparisons between distinct `record` types ([#&#8203;6107](https://redirect.github.com/google/error-prone/issues/6107)). - [`ReferenceEquality`](https://errorprone.info/bugpattern/ReferenceEquality): Allow `==` comparisons on `private` classes whose type hierarchy does not override `Object.equals` ([#&#8203;5865](https://redirect.github.com/google/error-prone/issues/5865)), `private static final` sentinel fields, `Thread` ([#&#8203;5900](https://redirect.github.com/google/error-prone/issues/5900)), and `com.sun.source.tree.Tree`. - [`PatternMatchingInstanceof`](https://errorprone.info/bugpattern/PatternMatchingInstanceof): Support `while` and `for` loops, parenthesized expressions ([#&#8203;5843](https://redirect.github.com/google/error-prone/issues/5843)), and replacing additional redundant casts when the `instanceof` already introduces a pattern variable. - [`DistinctVarargsChecker`](https://errorprone.info/bugpattern/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`](https://errorprone.info/bugpattern/MustBeClosedChecker): Require `java.lang.foreign.Arena.ofConfined` and `Arena.ofShared` to be closed. - [`ImpossibleNullComparison`](https://errorprone.info/bugpattern/ImpossibleNullComparison): Flag null checks on the return value of `Class.forName`. - [`RestrictedApi`](https://errorprone.info/bugpattern/RestrictedApi) / [`RestrictedInheritance`](https://errorprone.info/bugpattern/RestrictedInheritance): Added an `allowedPaths` attribute to allow calls or inheritance from matching file paths without a regular expression. - [`InlineMeInliner`](https://errorprone.info/bugpattern/InlineMeInliner): Support substituting type arguments at call sites when inlining generic `@InlineMe` methods. - [`WellKnownKeep`](https://errorprone.info/bugpattern/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 ([#&#8203;6079](https://redirect.github.com/google/error-prone/issues/6079)). - `CompilationTestHelper` now reports all lines with mismatched diagnostic expectations in a single test run rather than failing on the first mismatch ([#&#8203;6116](https://redirect.github.com/google/error-prone/issues/6116)). - Replaced the RE2/J dependency with [SafeRE](https://redirect.github.com/eaftan/safere). Closed issues: [#&#8203;4914](https://redirect.github.com/google/error-prone/issues/4914), [#&#8203;5182](https://redirect.github.com/google/error-prone/issues/5182), [#&#8203;5843](https://redirect.github.com/google/error-prone/issues/5843), [#&#8203;5857](https://redirect.github.com/google/error-prone/issues/5857), [#&#8203;5865](https://redirect.github.com/google/error-prone/issues/5865), [#&#8203;5878](https://redirect.github.com/google/error-prone/issues/5878), [#&#8203;5900](https://redirect.github.com/google/error-prone/issues/5900), [#&#8203;6029](https://redirect.github.com/google/error-prone/issues/6029), [#&#8203;6079](https://redirect.github.com/google/error-prone/issues/6079), [#&#8203;6107](https://redirect.github.com/google/error-prone/issues/6107), [#&#8203;6116](https://redirect.github.com/google/error-prone/issues/6116), [#&#8203;6133](https://redirect.github.com/google/error-prone/issues/6133) </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/prometheus/client_java). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xNzYuMyIsInVwZGF0ZWRJblZlciI6IjQ0LjE4OC4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiXX0=--> --------- Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
1 parent ba62c2d commit ffabc10

3 files changed

Lines changed: 11 additions & 2 deletions

File tree

  • prometheus-metrics-model/src
    • main/java/io/prometheus/metrics/model/snapshots
    • test/java/io/prometheus/metrics/model/snapshots

‎pom.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@
477477
<path>
478478
<groupId>com.google.errorprone</groupId>
479479
<artifactId>error_prone_core</artifactId>
480-
<version>2.50.0</version>
480+
<version>2.51.0</version>
481481
</path>
482482
<path>
483483
<groupId>com.uber.nullaway</groupId>

‎prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/snapshots/Unit.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,6 @@ public boolean equals(Object o) {
7575

7676
@Override
7777
public int hashCode() {
78-
return Objects.hash(name);
78+
return 31 + Objects.hashCode(name);
7979
}
8080
}

‎prometheus-metrics-model/src/test/java/io/prometheus/metrics/model/snapshots/UnitTest.java‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,13 @@ void testEquals4() {
4343

4444
assertThat(unit1).isEqualTo(unit2);
4545
}
46+
47+
@Test
48+
void testEqualUnitsHaveEqualHashCodes() {
49+
Unit unit1 = new Unit(" bytes ");
50+
Unit unit2 = new Unit("bytes");
51+
52+
assertThat(unit1).isEqualTo(unit2);
53+
assertThat(unit1.hashCode()).isEqualTo(unit2.hashCode());
54+
}
4655
}

0 commit comments

Comments
 (0)