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 81d84cc647c9..8c8c05ec1d12 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 @@ -16,10 +16,8 @@ package com.google.common.base; -import static jsinterop.annotations.JsPackage.GLOBAL; - import jsinterop.annotations.JsMethod; -import jsinterop.annotations.JsType; +import jsinterop.annotations.JsPackage; import org.checkerframework.checker.nullness.qual.Nullable; /** @author Jesse Wilson */ @@ -33,9 +31,12 @@ static CharMatcher precomputeCharMatcher(CharMatcher matcher) { } static String formatCompact4Digits(double value) { - return "" + ((Number) (Object) value).toPrecision(4); + return toPrecision(value, 4); } + @JsMethod(name = "Number.prototype.toPrecision.call", namespace = JsPackage.GLOBAL) + private static native String toPrecision(double value, int precision); + @JsMethod static native boolean stringIsNullOrEmpty(@Nullable String string) /*-{ return !string; @@ -51,11 +52,6 @@ static native String emptyToNull(@Nullable String string) /*-{ return string || null; }-*/; - @JsType(isNative = true, name = "number", namespace = GLOBAL) - private interface Number { - double toPrecision(int precision); - } - static CommonPattern compilePattern(String pattern) { throw new UnsupportedOperationException(); }