Skip to content

Commit bb77fa9

Browse files
chore(deps): update error-prone monorepo to v2.50.0 (#2212)
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.49.0` → `2.50.0` | ![age](https://developer.mend.io/api/mc/badges/age/maven/com.google.errorprone:error_prone_core/2.50.0?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/com.google.errorprone:error_prone_core/2.49.0/2.50.0?slim=true) | --- ### Release Notes <details> <summary>google/error-prone (com.google.errorprone:error_prone_core)</summary> ### [`v2.50.0`](https://redirect.github.com/google/error-prone/releases/tag/v2.50.0): Error Prone 2.50.0 [Compare Source](https://redirect.github.com/google/error-prone/compare/v2.49.0...v2.50.0) New checks: - [`BoxingComparator`](https://errorprone.info/bugpattern/BoxingComparator): Detect implicitly-boxing Comparator.comparing key extractors - [`ExposedPrivateType`](https://errorprone.info/bugpattern/ExposedPrivateType): Discourage references to private member classes from non-private APIs - [`JUnitMethodInvoked`](https://errorprone.info/bugpattern/JUnitMethodInvoked): Discourage directly invoking JUnit test methods - [`ListRemoveAmbiguous`](https://errorprone.info/bugpattern/ListRemoveAmbiguous): Detect ambiguous calls to `List.remove(int|Integer)` - [`PreferTestParameter`](https://errorprone.info/bugpattern/PreferTestParameter): suggests using `@TestParameter` instead of `@TestParameters` for exhaustive boolean and enum parameters on single-element parameterized tests - [`RecordComponentAccessorAnnotationConflict`](https://errorprone.info/bugpattern/RecordComponentAccessorAnnotationConflict): Detect conflicts between record components and explicit accessor methods - [`RecordComponentOverride`](https://errorprone.info/bugpattern/RecordComponentOverride): Discourage [@&#8203;Override](https://redirect.github.com/Override) on record component declarations that don't override anything - [`ThrowableEqualsHashCode`](https://errorprone.info/bugpattern/ThrowableEqualsHashCode): Discourage overriding `Throwable.equals()` and `hashCode()` Closed issues: [#&#8203;5553](https://redirect.github.com/google/error-prone/issues/5553), [#&#8203;5649](https://redirect.github.com/google/error-prone/issues/5649), [#&#8203;5778](https://redirect.github.com/google/error-prone/issues/5778) Full changelog: <google/error-prone@v2.49.0...v2.50.0> </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:eyJjcmVhdGVkSW5WZXIiOiI0My4yMDkuNCIsInVwZGF0ZWRJblZlciI6IjQzLjIxOS4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiXX0=--> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
1 parent 8289672 commit bb77fa9

7 files changed

Lines changed: 35 additions & 15 deletions

File tree

docs/apidiffs/current_vs_latest/prometheus-metrics-core.txt

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/apidiffs/current_vs_latest/prometheus-metrics-model.txt

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@
500500
<path>
501501
<groupId>com.google.errorprone</groupId>
502502
<artifactId>error_prone_core</artifactId>
503-
<version>2.49.0</version>
503+
<version>2.50.0</version>
504504
</path>
505505
<path>
506506
<groupId>com.uber.nullaway</groupId>

prometheus-metrics-core/src/main/java/io/prometheus/metrics/core/exemplars/ExemplarSampler.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@
3636
@StableApi
3737
public class ExemplarSampler {
3838

39+
@SuppressWarnings("ReferenceEquality")
40+
private static boolean sameObject(Object left, Object right) {
41+
return left == right;
42+
}
43+
3944
private final ExemplarSamplerConfig config;
4045
private final Exemplar[] exemplars;
4146
private final Exemplar[]
@@ -223,7 +228,7 @@ private long doObserveWithoutUpperBounds(double value) {
223228
int oldestIndex = -1;
224229
for (int i = 0; i < exemplars.length; i++) {
225230
Exemplar exemplar = exemplars[i];
226-
if (exemplar != null && exemplar != smallest && exemplar != largest) {
231+
if (exemplar != null && !sameObject(exemplar, smallest) && !sameObject(exemplar, largest)) {
227232
if (oldestTimestamp == 0 || exemplar.getTimestampMillis() < oldestTimestamp) {
228233
oldestTimestamp = exemplar.getTimestampMillis();
229234
oldestIndex = i;

prometheus-metrics-core/src/main/java/io/prometheus/metrics/core/metrics/CKMSQuantiles.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@
3434
*/
3535
final class CKMSQuantiles {
3636

37+
@SuppressWarnings("ReferenceEquality")
38+
private static boolean sameObject(Object left, Object right) {
39+
return left == right;
40+
}
41+
3742
final Quantile[] quantiles;
3843

3944
/** Total number of observations (not including those that are still in the buffer). */
@@ -203,7 +208,7 @@ void compress() {
203208
right = left;
204209
left = descendingIterator.next();
205210
r = r - left.g;
206-
if (left == samples.getFirst()) {
211+
if (sameObject(left, samples.getFirst())) {
207212
// The min sample must never be merged.
208213
break;
209214
}

prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/snapshots/Labels.java

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ static String[] makePrometheusNames(String[] names) {
124124
for (int i = 0; i < names.length; i++) {
125125
String name = names[i];
126126
if (!PrometheusNaming.isValidLegacyLabelName(name)) {
127-
if (prometheusNames == names) {
127+
if (sameObject(prometheusNames, names)) {
128128
prometheusNames = Arrays.copyOf(names, names.length);
129129
}
130130
prometheusNames[i] = PrometheusNaming.prometheusName(name);
@@ -234,7 +234,8 @@ public Labels merge(Labels other) {
234234
}
235235
String[] names = new String[this.names.length + other.names.length];
236236
String[] prometheusNames = names;
237-
if (this.names != this.prometheusNames || other.names != other.prometheusNames) {
237+
if (!sameObject(this.names, this.prometheusNames)
238+
|| !sameObject(other.names, other.prometheusNames)) {
238239
prometheusNames = new String[names.length];
239240
}
240241
String[] values = new String[names.length];
@@ -244,28 +245,28 @@ public Labels merge(Labels other) {
244245
if (thisPos >= this.names.length) {
245246
names[thisPos + otherPos] = other.names[otherPos];
246247
values[thisPos + otherPos] = other.values[otherPos];
247-
if (prometheusNames != names) {
248+
if (!sameObject(prometheusNames, names)) {
248249
prometheusNames[thisPos + otherPos] = other.prometheusNames[otherPos];
249250
}
250251
otherPos++;
251252
} else if (otherPos >= other.names.length) {
252253
names[thisPos + otherPos] = this.names[thisPos];
253254
values[thisPos + otherPos] = this.values[thisPos];
254-
if (prometheusNames != names) {
255+
if (!sameObject(prometheusNames, names)) {
255256
prometheusNames[thisPos + otherPos] = this.prometheusNames[thisPos];
256257
}
257258
thisPos++;
258259
} else if (this.prometheusNames[thisPos].compareTo(other.prometheusNames[otherPos]) < 0) {
259260
names[thisPos + otherPos] = this.names[thisPos];
260261
values[thisPos + otherPos] = this.values[thisPos];
261-
if (prometheusNames != names) {
262+
if (!sameObject(prometheusNames, names)) {
262263
prometheusNames[thisPos + otherPos] = this.prometheusNames[thisPos];
263264
}
264265
thisPos++;
265266
} else if (this.prometheusNames[thisPos].compareTo(other.prometheusNames[otherPos]) > 0) {
266267
names[thisPos + otherPos] = other.names[otherPos];
267268
values[thisPos + otherPos] = other.values[otherPos];
268-
if (prometheusNames != names) {
269+
if (!sameObject(prometheusNames, names)) {
269270
prometheusNames[thisPos + otherPos] = other.prometheusNames[otherPos];
270271
}
271272
otherPos++;
@@ -321,6 +322,11 @@ public int compareTo(Labels other) {
321322
}
322323

323324
// Looks like Java doesn't have a compareTo() method for arrays.
325+
@SuppressWarnings("ReferenceEquality")
326+
private static boolean sameObject(Object left, Object right) {
327+
return left == right;
328+
}
329+
324330
private int compare(String[] array1, String[] array2) {
325331
int result;
326332
for (int i = 0; i < array1.length; i++) {
@@ -505,14 +511,14 @@ private static void insertionSort(
505511
int j = i - 1;
506512
while (j >= left && compare(prometheusNames[j], prometheusName) > 0) {
507513
names[j + 1] = names[j];
508-
if (prometheusNames != names) {
514+
if (!sameObject(prometheusNames, names)) {
509515
prometheusNames[j + 1] = prometheusNames[j];
510516
}
511517
values[j + 1] = values[j];
512518
j--;
513519
}
514520
names[j + 1] = name;
515-
if (prometheusNames != names) {
521+
if (!sameObject(prometheusNames, names)) {
516522
prometheusNames[j + 1] = prometheusName;
517523
}
518524
values[j + 1] = value;
@@ -594,7 +600,7 @@ private static void swap(
594600
tmp = values[i];
595601
values[i] = values[j];
596602
values[j] = tmp;
597-
if (prometheusNames != names) {
603+
if (!sameObject(prometheusNames, names)) {
598604
tmp = prometheusNames[i];
599605
prometheusNames[i] = prometheusNames[j];
600606
prometheusNames[j] = tmp;

prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/snapshots/Quantiles.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public class Quantiles implements Iterable<Quantile> {
1717

1818
private Quantiles(List<Quantile> quantiles) {
1919
quantiles = new ArrayList<>(quantiles);
20-
quantiles.sort(Comparator.comparing(Quantile::getQuantile));
20+
quantiles.sort(Comparator.comparingDouble(Quantile::getQuantile));
2121
this.quantiles = Collections.unmodifiableList(quantiles);
2222
validate();
2323
}

0 commit comments

Comments
 (0)