From d58f5fdf7d9421850d4059dda4d3777f5fe03b85 Mon Sep 17 00:00:00 2001 From: ibaker Date: Thu, 14 Sep 2023 09:46:50 -0700 Subject: [PATCH] Upgrade Guava dependency to 32.1.2 Android's version of Guava was upgraded in http://r.android.com/2731599 PiperOrigin-RevId: 565396612 --- constants.gradle | 2 +- .../java/androidx/media3/common/util/Util.java | 15 --------------- .../UtilScaleLargeValueParameterizedTest.java | 4 ---- 3 files changed, 1 insertion(+), 20 deletions(-) diff --git a/constants.gradle b/constants.gradle index 4eefd7e70d..ae76379841 100644 --- a/constants.gradle +++ b/constants.gradle @@ -24,7 +24,7 @@ project.ext { junitVersion = '4.13.2' // Use the same Guava version as the Android repo: // https://cs.android.com/android/platform/superproject/+/master:external/guava/METADATA - guavaVersion = '31.1-android' + guavaVersion = '32.1.2-android' mockitoVersion = '3.12.4' robolectricVersion = '4.10.3' // Keep this in sync with Google's internal Checker Framework version. diff --git a/libraries/common/src/main/java/androidx/media3/common/util/Util.java b/libraries/common/src/main/java/androidx/media3/common/util/Util.java index a77b09985d..5e1201f32e 100644 --- a/libraries/common/src/main/java/androidx/media3/common/util/Util.java +++ b/libraries/common/src/main/java/androidx/media3/common/util/Util.java @@ -1661,11 +1661,6 @@ public final class Util { * @param roundingMode The rounding mode to use if the result of the division is not an integer. * @return The scaled value. */ - // LongMath.saturatedMultiply is @Beta in the version of Guava we currently depend on (31.1) - // but it is no longer @Beta from 32.0.0. This suppression is therefore safe because there's - // no version of Guava after 31.1 that doesn't contain this symbol. - // TODO(b/290045069): Remove this suppression when we depend on Guava 32+. - @SuppressWarnings("UnstableApiUsage") @UnstableApi public static long scaleLargeValue( long value, long multiplier, long divisor, RoundingMode roundingMode) { @@ -1698,11 +1693,6 @@ public final class Util { * @param roundingMode The rounding mode to use if the result of the division is not an integer. * @return The scaled values. */ - // LongMath.saturatedMultiply is @Beta in the version of Guava we currently depend on (31.1) - // but it is no longer @Beta from 32.0.0. This suppression is therefore safe because there's - // no version of Guava after 31.1 that doesn't contain this symbol. - // TODO(b/290045069): Remove this suppression when we depend on Guava 32+. - @SuppressWarnings("UnstableApiUsage") @UnstableApi public static long[] scaleLargeValues( List values, long multiplier, long divisor, RoundingMode roundingMode) { @@ -1802,11 +1792,6 @@ public final class Util { *

This implementation should be used after simpler simplifying efforts have failed (such as * checking if {@code value} or {@code multiplier} are exact multiples of {@code divisor}). */ - // LongMath.saturatedMultiply is @Beta in the version of Guava we currently depend on (31.1) - // but it is no longer @Beta from 32.0.0. This suppression is therefore safe because there's - // no version of Guava after 31.1 that doesn't contain this symbol. - // TODO(b/290045069): Remove this suppression when we depend on Guava 32+. - @SuppressWarnings("UnstableApiUsage") private static long scaleLargeValueFallback( long value, long multiplier, long divisor, RoundingMode roundingMode) { long numerator = LongMath.saturatedMultiply(value, multiplier); diff --git a/libraries/common/src/test/java/androidx/media3/common/util/UtilScaleLargeValueParameterizedTest.java b/libraries/common/src/test/java/androidx/media3/common/util/UtilScaleLargeValueParameterizedTest.java index 65be0c828a..a57b1c10ad 100644 --- a/libraries/common/src/test/java/androidx/media3/common/util/UtilScaleLargeValueParameterizedTest.java +++ b/libraries/common/src/test/java/androidx/media3/common/util/UtilScaleLargeValueParameterizedTest.java @@ -231,8 +231,6 @@ public class UtilScaleLargeValueParameterizedTest { * floating-point branch (which will cause this test to fail because passing * RoundingMode.UNNECESSARY won't be allowed). */ - // TODO(b/290045069): Remove this suppression when we depend on Guava 32+. - @SuppressWarnings("UnstableApiUsage") @Test public void cancelsRatherThanFallThroughToFloatingPoint() { long value = 24960; @@ -247,8 +245,6 @@ public class UtilScaleLargeValueParameterizedTest { assertThat(result).isEqualTo(520000); } - // TODO(b/290045069): Remove this suppression when we depend on Guava 32+. - @SuppressWarnings("UnstableApiUsage") @Test public void numeratorOverflowsAndCantBeCancelled() { // Use three Mersenne primes so nothing can cancel, and the numerator will (just) overflow 64