From 7526d1b9ab74088f553f2c55f360f8cc0944d17c Mon Sep 17 00:00:00 2001 From: cpovirk Date: Wed, 30 Oct 2024 11:20:00 -0700 Subject: [PATCH] Fix another accidental use of varargs `min`/`max` calls. As in cl/689775552, I'm fixing a mistaken change from cl/687381111. RELNOTES=n/a PiperOrigin-RevId: 691489572 --- .../guava/src/com/google/common/primitives/UnsignedInts.java | 5 +++-- guava/src/com/google/common/primitives/UnsignedInts.java | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/android/guava/src/com/google/common/primitives/UnsignedInts.java b/android/guava/src/com/google/common/primitives/UnsignedInts.java index 38012784c371..4909b68b94ac 100644 --- a/android/guava/src/com/google/common/primitives/UnsignedInts.java +++ b/android/guava/src/com/google/common/primitives/UnsignedInts.java @@ -17,7 +17,6 @@ import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkPositionIndexes; -import static java.lang.Math.min; import com.google.common.annotations.GwtCompatible; import com.google.errorprone.annotations.CanIgnoreReturnValue; @@ -196,8 +195,10 @@ enum LexicographicalComparator implements Comparator { INSTANCE; @Override + // A call to bare "min" or "max" would resolve to our varargs method, not to any static import. + @SuppressWarnings("StaticImportPreferred") public int compare(int[] left, int[] right) { - int minLength = min(left.length, right.length); + int minLength = Math.min(left.length, right.length); for (int i = 0; i < minLength; i++) { if (left[i] != right[i]) { return UnsignedInts.compare(left[i], right[i]); diff --git a/guava/src/com/google/common/primitives/UnsignedInts.java b/guava/src/com/google/common/primitives/UnsignedInts.java index 38012784c371..4909b68b94ac 100644 --- a/guava/src/com/google/common/primitives/UnsignedInts.java +++ b/guava/src/com/google/common/primitives/UnsignedInts.java @@ -17,7 +17,6 @@ import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkPositionIndexes; -import static java.lang.Math.min; import com.google.common.annotations.GwtCompatible; import com.google.errorprone.annotations.CanIgnoreReturnValue; @@ -196,8 +195,10 @@ enum LexicographicalComparator implements Comparator { INSTANCE; @Override + // A call to bare "min" or "max" would resolve to our varargs method, not to any static import. + @SuppressWarnings("StaticImportPreferred") public int compare(int[] left, int[] right) { - int minLength = min(left.length, right.length); + int minLength = Math.min(left.length, right.length); for (int i = 0; i < minLength; i++) { if (left[i] != right[i]) { return UnsignedInts.compare(left[i], right[i]);