diff --git a/android/guava/src/com/google/common/base/Platform.java b/android/guava/src/com/google/common/base/Platform.java index 703b8605b1d5..1967be713478 100644 --- a/android/guava/src/com/google/common/base/Platform.java +++ b/android/guava/src/com/google/common/base/Platform.java @@ -36,12 +36,6 @@ final class Platform { private Platform() {} - /** Calls {@link System#nanoTime()}. */ - @SuppressWarnings("GoodTime") // reading system time without TimeSource - static long systemNanoTime() { - return System.nanoTime(); - } - static CharMatcher precomputeCharMatcher(CharMatcher matcher) { return matcher.precomputedInternal(); } diff --git a/android/guava/src/com/google/common/base/Suppliers.java b/android/guava/src/com/google/common/base/Suppliers.java index 7e8f7ccdaf7b..d97bff626b0e 100644 --- a/android/guava/src/com/google/common/base/Suppliers.java +++ b/android/guava/src/com/google/common/base/Suppliers.java @@ -245,6 +245,7 @@ static class ExpiringMemoizingSupplier @Override @ParametricNullness + @SuppressWarnings("GoodTime") // reading system time without TimeSource public T get() { // Another variant of Double Checked Locking. // @@ -253,7 +254,7 @@ public T get() { // the extra memory consumption and indirection are more // expensive than the extra volatile reads. long nanos = expirationNanos; - long now = Platform.systemNanoTime(); + long now = System.nanoTime(); if (nanos == 0 || now - nanos >= 0) { synchronized (this) { if (nanos == expirationNanos) { // recheck for lost race diff --git a/android/guava/src/com/google/common/base/Ticker.java b/android/guava/src/com/google/common/base/Ticker.java index d898735c028f..5b7a48688659 100644 --- a/android/guava/src/com/google/common/base/Ticker.java +++ b/android/guava/src/com/google/common/base/Ticker.java @@ -48,8 +48,9 @@ public static Ticker systemTicker() { private static final Ticker SYSTEM_TICKER = new Ticker() { @Override + @SuppressWarnings("GoodTime") // reading system time without TimeSource public long read() { - return Platform.systemNanoTime(); + return System.nanoTime(); } }; } diff --git a/guava-gwt/src-super/com/google/common/base/super/com/google/common/base/Platform.java b/guava-gwt/src-super/com/google/common/base/super/com/google/common/base/Platform.java index 2e17c9a28d22..1f7dc4e276fc 100644 --- a/guava-gwt/src-super/com/google/common/base/super/com/google/common/base/Platform.java +++ b/guava-gwt/src-super/com/google/common/base/super/com/google/common/base/Platform.java @@ -18,7 +18,6 @@ import static jsinterop.annotations.JsPackage.GLOBAL; -import java.util.concurrent.TimeUnit; import jsinterop.annotations.JsMethod; import jsinterop.annotations.JsType; import org.checkerframework.checker.nullness.qual.Nullable; @@ -33,13 +32,6 @@ static CharMatcher precomputeCharMatcher(CharMatcher matcher) { return matcher; } - @SuppressWarnings("GoodTime") // reading system time without TimeSource - static long systemNanoTime() { - // System.nanoTime() is not available in GWT, so we get milliseconds - // and convert to nanos. - return TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()); - } - static > Optional getEnumIfPresent(Class enumClass, String value) { try { return Optional.of(Enum.valueOf(enumClass, value)); diff --git a/guava/src/com/google/common/base/Platform.java b/guava/src/com/google/common/base/Platform.java index 644e89cbfa5d..d2433d65ee2e 100644 --- a/guava/src/com/google/common/base/Platform.java +++ b/guava/src/com/google/common/base/Platform.java @@ -36,12 +36,6 @@ final class Platform { private Platform() {} - /** Calls {@link System#nanoTime()}. */ - @SuppressWarnings("GoodTime") // reading system time without TimeSource - static long systemNanoTime() { - return System.nanoTime(); - } - static CharMatcher precomputeCharMatcher(CharMatcher matcher) { return matcher.precomputedInternal(); } diff --git a/guava/src/com/google/common/base/Suppliers.java b/guava/src/com/google/common/base/Suppliers.java index 7e8f7ccdaf7b..d97bff626b0e 100644 --- a/guava/src/com/google/common/base/Suppliers.java +++ b/guava/src/com/google/common/base/Suppliers.java @@ -245,6 +245,7 @@ static class ExpiringMemoizingSupplier @Override @ParametricNullness + @SuppressWarnings("GoodTime") // reading system time without TimeSource public T get() { // Another variant of Double Checked Locking. // @@ -253,7 +254,7 @@ public T get() { // the extra memory consumption and indirection are more // expensive than the extra volatile reads. long nanos = expirationNanos; - long now = Platform.systemNanoTime(); + long now = System.nanoTime(); if (nanos == 0 || now - nanos >= 0) { synchronized (this) { if (nanos == expirationNanos) { // recheck for lost race diff --git a/guava/src/com/google/common/base/Ticker.java b/guava/src/com/google/common/base/Ticker.java index d898735c028f..5b7a48688659 100644 --- a/guava/src/com/google/common/base/Ticker.java +++ b/guava/src/com/google/common/base/Ticker.java @@ -48,8 +48,9 @@ public static Ticker systemTicker() { private static final Ticker SYSTEM_TICKER = new Ticker() { @Override + @SuppressWarnings("GoodTime") // reading system time without TimeSource public long read() { - return Platform.systemNanoTime(); + return System.nanoTime(); } }; }