parent
f89053dbb0
commit
2c0d9ba4c3
@ -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 = '32.1.2-android'
|
||||
guavaVersion = '31.1-android'
|
||||
mockitoVersion = '3.12.4'
|
||||
robolectricVersion = '4.10.3'
|
||||
// Keep this in sync with Google's internal Checker Framework version.
|
||||
|
@ -1661,6 +1661,11 @@ 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) {
|
||||
@ -1693,6 +1698,11 @@ 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<Long> values, long multiplier, long divisor, RoundingMode roundingMode) {
|
||||
@ -1792,6 +1802,11 @@ public final class Util {
|
||||
* <p>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);
|
||||
|
@ -231,6 +231,8 @@ 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;
|
||||
@ -245,6 +247,8 @@ 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
|
||||
|
Loading…
x
Reference in New Issue
Block a user