diff --git a/android/guava-tests/test/com/google/common/primitives/DoublesTest.java b/android/guava-tests/test/com/google/common/primitives/DoublesTest.java index 293fdb1aadc4..871b84c286ff 100644 --- a/android/guava-tests/test/com/google/common/primitives/DoublesTest.java +++ b/android/guava-tests/test/com/google/common/primitives/DoublesTest.java @@ -194,6 +194,7 @@ public void testLastIndexOf() { assertEquals(-1, Doubles.lastIndexOf(new double[] {NaN, 5.0}, NaN)); } + @GwtIncompatible public void testMax_noArgs() { try { Doubles.max(); @@ -216,6 +217,7 @@ public void testMax() { assertTrue(Double.isNaN(Doubles.max(VALUES))); } + @GwtIncompatible public void testMin_noArgs() { try { Doubles.min(); diff --git a/android/guava-tests/test/com/google/common/primitives/FloatsTest.java b/android/guava-tests/test/com/google/common/primitives/FloatsTest.java index 7eb0c5b78c27..fd59ad4d82a6 100644 --- a/android/guava-tests/test/com/google/common/primitives/FloatsTest.java +++ b/android/guava-tests/test/com/google/common/primitives/FloatsTest.java @@ -186,6 +186,7 @@ public void testLastIndexOf() { assertEquals(-1, Floats.lastIndexOf(new float[] {NaN, 5f}, NaN)); } + @GwtIncompatible public void testMax_noArgs() { try { Floats.max(); @@ -207,6 +208,7 @@ public void testMax() { assertTrue(Float.isNaN(Floats.max(VALUES))); } + @GwtIncompatible public void testMin_noArgs() { try { Floats.min(); diff --git a/android/guava-tests/test/com/google/common/primitives/IntsTest.java b/android/guava-tests/test/com/google/common/primitives/IntsTest.java index 4487897a6c0e..72154224c7f4 100644 --- a/android/guava-tests/test/com/google/common/primitives/IntsTest.java +++ b/android/guava-tests/test/com/google/common/primitives/IntsTest.java @@ -155,6 +155,7 @@ public void testLastIndexOf() { assertEquals(3, Ints.lastIndexOf(new int[] {(int) 2, (int) 3, (int) 2, (int) 3}, (int) 3)); } + @GwtIncompatible public void testMax_noArgs() { try { Ints.max(); @@ -169,6 +170,7 @@ public void testMax() { assertEquals((int) 9, Ints.max((int) 8, (int) 6, (int) 7, (int) 5, (int) 3, (int) 0, (int) 9)); } + @GwtIncompatible public void testMin_noArgs() { try { Ints.min(); diff --git a/android/guava-tests/test/com/google/common/primitives/ShortsTest.java b/android/guava-tests/test/com/google/common/primitives/ShortsTest.java index bc4d9515b853..0816c6973c0d 100644 --- a/android/guava-tests/test/com/google/common/primitives/ShortsTest.java +++ b/android/guava-tests/test/com/google/common/primitives/ShortsTest.java @@ -175,6 +175,7 @@ public void testLastIndexOf() { 3, Shorts.lastIndexOf(new short[] {(short) 2, (short) 3, (short) 2, (short) 3}, (short) 3)); } + @GwtIncompatible public void testMax_noArgs() { try { Shorts.max(); @@ -191,6 +192,7 @@ public void testMax() { Shorts.max((short) 8, (short) 6, (short) 7, (short) 5, (short) 3, (short) 0, (short) 9)); } + @GwtIncompatible public void testMin_noArgs() { try { Shorts.min(); diff --git a/android/guava/src/com/google/common/primitives/Doubles.java b/android/guava/src/com/google/common/primitives/Doubles.java index 1184929076ff..25805e2197a2 100644 --- a/android/guava/src/com/google/common/primitives/Doubles.java +++ b/android/guava/src/com/google/common/primitives/Doubles.java @@ -46,7 +46,7 @@ * @since 1.0 */ @GwtCompatible(emulated = true) -public final class Doubles { +public final class Doubles extends DoublesMethodsForWeb { private Doubles() {} /** @@ -207,6 +207,8 @@ private static int lastIndexOf(double[] array, double target, int start, int end * the array * @throws IllegalArgumentException if {@code array} is empty */ + @GwtIncompatible( + "Available in GWT! Annotation is to avoid conflict with GWT specialization of base class.") public static double min(double... array) { checkArgument(array.length > 0); double min = array[0]; @@ -225,6 +227,8 @@ public static double min(double... array) { * in the array * @throws IllegalArgumentException if {@code array} is empty */ + @GwtIncompatible( + "Available in GWT! Annotation is to avoid conflict with GWT specialization of base class.") public static double max(double... array) { checkArgument(array.length > 0); double max = array[0]; diff --git a/android/guava/src/com/google/common/primitives/DoublesMethodsForWeb.java b/android/guava/src/com/google/common/primitives/DoublesMethodsForWeb.java new file mode 100644 index 000000000000..04d96512211d --- /dev/null +++ b/android/guava/src/com/google/common/primitives/DoublesMethodsForWeb.java @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2020 The Guava Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package com.google.common.primitives; + +import com.google.common.annotations.GwtCompatible; + +/** + * Holder for web specializations of methods of {@code Doubles}. Intended to be empty for regular + * version. + */ +@GwtCompatible(emulated = true) +abstract class DoublesMethodsForWeb {} diff --git a/android/guava/src/com/google/common/primitives/Floats.java b/android/guava/src/com/google/common/primitives/Floats.java index d3c562526b7a..292aa29a1de6 100644 --- a/android/guava/src/com/google/common/primitives/Floats.java +++ b/android/guava/src/com/google/common/primitives/Floats.java @@ -46,7 +46,7 @@ * @since 1.0 */ @GwtCompatible(emulated = true) -public final class Floats { +public final class Floats extends FloatsMethodsForWeb { private Floats() {} /** @@ -204,6 +204,8 @@ private static int lastIndexOf(float[] array, float target, int start, int end) * the array * @throws IllegalArgumentException if {@code array} is empty */ + @GwtIncompatible( + "Available in GWT! Annotation is to avoid conflict with GWT specialization of base class.") public static float min(float... array) { checkArgument(array.length > 0); float min = array[0]; @@ -222,6 +224,8 @@ public static float min(float... array) { * in the array * @throws IllegalArgumentException if {@code array} is empty */ + @GwtIncompatible( + "Available in GWT! Annotation is to avoid conflict with GWT specialization of base class.") public static float max(float... array) { checkArgument(array.length > 0); float max = array[0]; diff --git a/android/guava/src/com/google/common/primitives/FloatsMethodsForWeb.java b/android/guava/src/com/google/common/primitives/FloatsMethodsForWeb.java new file mode 100644 index 000000000000..acdb42f275b1 --- /dev/null +++ b/android/guava/src/com/google/common/primitives/FloatsMethodsForWeb.java @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2020 The Guava Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package com.google.common.primitives; + +import com.google.common.annotations.GwtCompatible; + +/** + * Holder for web specializations of methods of {@code Floats}. Intended to be empty for regular + * version. + */ +@GwtCompatible(emulated = true) +abstract class FloatsMethodsForWeb {} diff --git a/android/guava/src/com/google/common/primitives/Ints.java b/android/guava/src/com/google/common/primitives/Ints.java index 6f64eec9e134..93b5ba0ac7b0 100644 --- a/android/guava/src/com/google/common/primitives/Ints.java +++ b/android/guava/src/com/google/common/primitives/Ints.java @@ -21,6 +21,7 @@ import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; +import com.google.common.annotations.GwtIncompatible; import com.google.common.base.Converter; import java.io.Serializable; import java.util.AbstractList; @@ -42,8 +43,8 @@ * @author Kevin Bourrillion * @since 1.0 */ -@GwtCompatible -public final class Ints { +@GwtCompatible(emulated = true) +public final class Ints extends IntsMethodsForWeb { private Ints() {} /** @@ -218,6 +219,8 @@ private static int lastIndexOf(int[] array, int target, int start, int end) { * the array * @throws IllegalArgumentException if {@code array} is empty */ + @GwtIncompatible( + "Available in GWT! Annotation is to avoid conflict with GWT specialization of base class.") public static int min(int... array) { checkArgument(array.length > 0); int min = array[0]; @@ -237,6 +240,8 @@ public static int min(int... array) { * in the array * @throws IllegalArgumentException if {@code array} is empty */ + @GwtIncompatible( + "Available in GWT! Annotation is to avoid conflict with GWT specialization of base class.") public static int max(int... array) { checkArgument(array.length > 0); int max = array[0]; diff --git a/android/guava/src/com/google/common/primitives/IntsMethodsForWeb.java b/android/guava/src/com/google/common/primitives/IntsMethodsForWeb.java new file mode 100644 index 000000000000..cb87bd2929f8 --- /dev/null +++ b/android/guava/src/com/google/common/primitives/IntsMethodsForWeb.java @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2020 The Guava Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package com.google.common.primitives; + +import com.google.common.annotations.GwtCompatible; + +/** + * Holder for web specializations of methods of {@code Ints}. Intended to be empty for regular + * version. + */ +@GwtCompatible(emulated = true) +abstract class IntsMethodsForWeb {} diff --git a/android/guava/src/com/google/common/primitives/Shorts.java b/android/guava/src/com/google/common/primitives/Shorts.java index 18309cda6b72..dc58138814b8 100644 --- a/android/guava/src/com/google/common/primitives/Shorts.java +++ b/android/guava/src/com/google/common/primitives/Shorts.java @@ -44,7 +44,7 @@ * @since 1.0 */ @GwtCompatible(emulated = true) -public final class Shorts { +public final class Shorts extends ShortsMethodsForWeb { private Shorts() {} /** @@ -218,6 +218,8 @@ private static int lastIndexOf(short[] array, short target, int start, int end) * the array * @throws IllegalArgumentException if {@code array} is empty */ + @GwtIncompatible( + "Available in GWT! Annotation is to avoid conflict with GWT specialization of base class.") public static short min(short... array) { checkArgument(array.length > 0); short min = array[0]; @@ -237,6 +239,8 @@ public static short min(short... array) { * in the array * @throws IllegalArgumentException if {@code array} is empty */ + @GwtIncompatible( + "Available in GWT! Annotation is to avoid conflict with GWT specialization of base class.") public static short max(short... array) { checkArgument(array.length > 0); short max = array[0]; diff --git a/android/guava/src/com/google/common/primitives/ShortsMethodsForWeb.java b/android/guava/src/com/google/common/primitives/ShortsMethodsForWeb.java new file mode 100644 index 000000000000..c36276838cc6 --- /dev/null +++ b/android/guava/src/com/google/common/primitives/ShortsMethodsForWeb.java @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2020 The Guava Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package com.google.common.primitives; + +import com.google.common.annotations.GwtCompatible; + +/** + * Holder for web specializations of methods of {@code Shorts}. Intended to be empty for regular + * version. + */ +@GwtCompatible(emulated = true) +abstract class ShortsMethodsForWeb {} diff --git a/guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/DoublesMethodsForWeb.java b/guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/DoublesMethodsForWeb.java new file mode 100644 index 000000000000..2fdd4c1753ca --- /dev/null +++ b/guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/DoublesMethodsForWeb.java @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2020 The Guava Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package com.google.common.primitives; + +import jsinterop.annotations.JsMethod; +import jsinterop.annotations.JsPackage; + +/** Web specializations for {@link Doubles} methods. */ +abstract class DoublesMethodsForWeb { + + @JsMethod(name = "Math.min", namespace = JsPackage.GLOBAL) + public static native double min(double... array); + + @JsMethod(name = "Math.max", namespace = JsPackage.GLOBAL) + public static native double max(double... array); +} diff --git a/guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/FloatsMethodsForWeb.java b/guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/FloatsMethodsForWeb.java new file mode 100644 index 000000000000..61d57ccb452b --- /dev/null +++ b/guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/FloatsMethodsForWeb.java @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2020 The Guava Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package com.google.common.primitives; + +import jsinterop.annotations.JsMethod; +import jsinterop.annotations.JsPackage; + +/** Web specializations for {@link Floats} methods. */ +abstract class FloatsMethodsForWeb { + + @JsMethod(name = "Math.min", namespace = JsPackage.GLOBAL) + public static native float min(float... array); + + @JsMethod(name = "Math.max", namespace = JsPackage.GLOBAL) + public static native float max(float... array); +} diff --git a/guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/IntsMethodsForWeb.java b/guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/IntsMethodsForWeb.java new file mode 100644 index 000000000000..540b2173fbda --- /dev/null +++ b/guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/IntsMethodsForWeb.java @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2020 The Guava Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package com.google.common.primitives; + +import jsinterop.annotations.JsMethod; +import jsinterop.annotations.JsPackage; + +/** Web specializations for {@link Ints} methods. */ +abstract class IntsMethodsForWeb { + + @JsMethod(name = "Math.min", namespace = JsPackage.GLOBAL) + public static native int min(int... array); + + @JsMethod(name = "Math.max", namespace = JsPackage.GLOBAL) + public static native int max(int... array); +} diff --git a/guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/ShortsMethodsForWeb.java b/guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/ShortsMethodsForWeb.java new file mode 100644 index 000000000000..8036e6cb306a --- /dev/null +++ b/guava-gwt/src-super/com/google/common/primitives/super/com/google/common/primitives/ShortsMethodsForWeb.java @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2020 The Guava Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package com.google.common.primitives; + +import jsinterop.annotations.JsMethod; +import jsinterop.annotations.JsPackage; + +/** Web specializations for {@link Shorts} methods. */ +abstract class ShortsMethodsForWeb { + + @JsMethod(name = "Math.min", namespace = JsPackage.GLOBAL) + public static native short min(short... array); + + @JsMethod(name = "Math.max", namespace = JsPackage.GLOBAL) + public static native short max(short... array); +} diff --git a/guava-gwt/test/com/google/common/primitives/DoublesTest_gwt.java b/guava-gwt/test/com/google/common/primitives/DoublesTest_gwt.java index fab1668a83a0..1f1f4d4ff088 100644 --- a/guava-gwt/test/com/google/common/primitives/DoublesTest_gwt.java +++ b/guava-gwt/test/com/google/common/primitives/DoublesTest_gwt.java @@ -108,21 +108,11 @@ public void testMax() throws Exception { testCase.testMax(); } -public void testMax_noArgs() throws Exception { - com.google.common.primitives.DoublesTest testCase = new com.google.common.primitives.DoublesTest(); - testCase.testMax_noArgs(); -} - public void testMin() throws Exception { com.google.common.primitives.DoublesTest testCase = new com.google.common.primitives.DoublesTest(); testCase.testMin(); } -public void testMin_noArgs() throws Exception { - com.google.common.primitives.DoublesTest testCase = new com.google.common.primitives.DoublesTest(); - testCase.testMin_noArgs(); -} - public void testReverse() throws Exception { com.google.common.primitives.DoublesTest testCase = new com.google.common.primitives.DoublesTest(); testCase.testReverse(); diff --git a/guava-gwt/test/com/google/common/primitives/FloatsTest_gwt.java b/guava-gwt/test/com/google/common/primitives/FloatsTest_gwt.java index ad24cec2e8f3..2fddc2c73f9d 100644 --- a/guava-gwt/test/com/google/common/primitives/FloatsTest_gwt.java +++ b/guava-gwt/test/com/google/common/primitives/FloatsTest_gwt.java @@ -103,21 +103,11 @@ public void testMax() throws Exception { testCase.testMax(); } -public void testMax_noArgs() throws Exception { - com.google.common.primitives.FloatsTest testCase = new com.google.common.primitives.FloatsTest(); - testCase.testMax_noArgs(); -} - public void testMin() throws Exception { com.google.common.primitives.FloatsTest testCase = new com.google.common.primitives.FloatsTest(); testCase.testMin(); } -public void testMin_noArgs() throws Exception { - com.google.common.primitives.FloatsTest testCase = new com.google.common.primitives.FloatsTest(); - testCase.testMin_noArgs(); -} - public void testReverse() throws Exception { com.google.common.primitives.FloatsTest testCase = new com.google.common.primitives.FloatsTest(); testCase.testReverse(); diff --git a/guava-gwt/test/com/google/common/primitives/IntsTest_gwt.java b/guava-gwt/test/com/google/common/primitives/IntsTest_gwt.java index 47f3f8b1ced2..ca849d551f87 100644 --- a/guava-gwt/test/com/google/common/primitives/IntsTest_gwt.java +++ b/guava-gwt/test/com/google/common/primitives/IntsTest_gwt.java @@ -128,21 +128,11 @@ public void testMax() throws Exception { testCase.testMax(); } -public void testMax_noArgs() throws Exception { - com.google.common.primitives.IntsTest testCase = new com.google.common.primitives.IntsTest(); - testCase.testMax_noArgs(); -} - public void testMin() throws Exception { com.google.common.primitives.IntsTest testCase = new com.google.common.primitives.IntsTest(); testCase.testMin(); } -public void testMin_noArgs() throws Exception { - com.google.common.primitives.IntsTest testCase = new com.google.common.primitives.IntsTest(); - testCase.testMin_noArgs(); -} - public void testReverse() throws Exception { com.google.common.primitives.IntsTest testCase = new com.google.common.primitives.IntsTest(); testCase.testReverse(); diff --git a/guava-gwt/test/com/google/common/primitives/ShortsTest_gwt.java b/guava-gwt/test/com/google/common/primitives/ShortsTest_gwt.java index ac6228203e72..37c27efe684a 100644 --- a/guava-gwt/test/com/google/common/primitives/ShortsTest_gwt.java +++ b/guava-gwt/test/com/google/common/primitives/ShortsTest_gwt.java @@ -108,21 +108,11 @@ public void testMax() throws Exception { testCase.testMax(); } -public void testMax_noArgs() throws Exception { - com.google.common.primitives.ShortsTest testCase = new com.google.common.primitives.ShortsTest(); - testCase.testMax_noArgs(); -} - public void testMin() throws Exception { com.google.common.primitives.ShortsTest testCase = new com.google.common.primitives.ShortsTest(); testCase.testMin(); } -public void testMin_noArgs() throws Exception { - com.google.common.primitives.ShortsTest testCase = new com.google.common.primitives.ShortsTest(); - testCase.testMin_noArgs(); -} - public void testReverse() throws Exception { com.google.common.primitives.ShortsTest testCase = new com.google.common.primitives.ShortsTest(); testCase.testReverse(); diff --git a/guava-tests/test/com/google/common/primitives/DoublesTest.java b/guava-tests/test/com/google/common/primitives/DoublesTest.java index 293fdb1aadc4..871b84c286ff 100644 --- a/guava-tests/test/com/google/common/primitives/DoublesTest.java +++ b/guava-tests/test/com/google/common/primitives/DoublesTest.java @@ -194,6 +194,7 @@ public void testLastIndexOf() { assertEquals(-1, Doubles.lastIndexOf(new double[] {NaN, 5.0}, NaN)); } + @GwtIncompatible public void testMax_noArgs() { try { Doubles.max(); @@ -216,6 +217,7 @@ public void testMax() { assertTrue(Double.isNaN(Doubles.max(VALUES))); } + @GwtIncompatible public void testMin_noArgs() { try { Doubles.min(); diff --git a/guava-tests/test/com/google/common/primitives/FloatsTest.java b/guava-tests/test/com/google/common/primitives/FloatsTest.java index 7eb0c5b78c27..fd59ad4d82a6 100644 --- a/guava-tests/test/com/google/common/primitives/FloatsTest.java +++ b/guava-tests/test/com/google/common/primitives/FloatsTest.java @@ -186,6 +186,7 @@ public void testLastIndexOf() { assertEquals(-1, Floats.lastIndexOf(new float[] {NaN, 5f}, NaN)); } + @GwtIncompatible public void testMax_noArgs() { try { Floats.max(); @@ -207,6 +208,7 @@ public void testMax() { assertTrue(Float.isNaN(Floats.max(VALUES))); } + @GwtIncompatible public void testMin_noArgs() { try { Floats.min(); diff --git a/guava-tests/test/com/google/common/primitives/IntsTest.java b/guava-tests/test/com/google/common/primitives/IntsTest.java index 4487897a6c0e..72154224c7f4 100644 --- a/guava-tests/test/com/google/common/primitives/IntsTest.java +++ b/guava-tests/test/com/google/common/primitives/IntsTest.java @@ -155,6 +155,7 @@ public void testLastIndexOf() { assertEquals(3, Ints.lastIndexOf(new int[] {(int) 2, (int) 3, (int) 2, (int) 3}, (int) 3)); } + @GwtIncompatible public void testMax_noArgs() { try { Ints.max(); @@ -169,6 +170,7 @@ public void testMax() { assertEquals((int) 9, Ints.max((int) 8, (int) 6, (int) 7, (int) 5, (int) 3, (int) 0, (int) 9)); } + @GwtIncompatible public void testMin_noArgs() { try { Ints.min(); diff --git a/guava-tests/test/com/google/common/primitives/ShortsTest.java b/guava-tests/test/com/google/common/primitives/ShortsTest.java index bc4d9515b853..0816c6973c0d 100644 --- a/guava-tests/test/com/google/common/primitives/ShortsTest.java +++ b/guava-tests/test/com/google/common/primitives/ShortsTest.java @@ -175,6 +175,7 @@ public void testLastIndexOf() { 3, Shorts.lastIndexOf(new short[] {(short) 2, (short) 3, (short) 2, (short) 3}, (short) 3)); } + @GwtIncompatible public void testMax_noArgs() { try { Shorts.max(); @@ -191,6 +192,7 @@ public void testMax() { Shorts.max((short) 8, (short) 6, (short) 7, (short) 5, (short) 3, (short) 0, (short) 9)); } + @GwtIncompatible public void testMin_noArgs() { try { Shorts.min(); diff --git a/guava/src/com/google/common/primitives/Doubles.java b/guava/src/com/google/common/primitives/Doubles.java index e35cac049f0b..eb865da9043a 100644 --- a/guava/src/com/google/common/primitives/Doubles.java +++ b/guava/src/com/google/common/primitives/Doubles.java @@ -48,7 +48,7 @@ * @since 1.0 */ @GwtCompatible(emulated = true) -public final class Doubles { +public final class Doubles extends DoublesMethodsForWeb { private Doubles() {} /** @@ -209,6 +209,8 @@ private static int lastIndexOf(double[] array, double target, int start, int end * the array * @throws IllegalArgumentException if {@code array} is empty */ + @GwtIncompatible( + "Available in GWT! Annotation is to avoid conflict with GWT specialization of base class.") public static double min(double... array) { checkArgument(array.length > 0); double min = array[0]; @@ -227,6 +229,8 @@ public static double min(double... array) { * in the array * @throws IllegalArgumentException if {@code array} is empty */ + @GwtIncompatible( + "Available in GWT! Annotation is to avoid conflict with GWT specialization of base class.") public static double max(double... array) { checkArgument(array.length > 0); double max = array[0]; diff --git a/guava/src/com/google/common/primitives/DoublesMethodsForWeb.java b/guava/src/com/google/common/primitives/DoublesMethodsForWeb.java new file mode 100644 index 000000000000..04d96512211d --- /dev/null +++ b/guava/src/com/google/common/primitives/DoublesMethodsForWeb.java @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2020 The Guava Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package com.google.common.primitives; + +import com.google.common.annotations.GwtCompatible; + +/** + * Holder for web specializations of methods of {@code Doubles}. Intended to be empty for regular + * version. + */ +@GwtCompatible(emulated = true) +abstract class DoublesMethodsForWeb {} diff --git a/guava/src/com/google/common/primitives/Floats.java b/guava/src/com/google/common/primitives/Floats.java index d3b554c3429a..1a99f41ebe2b 100644 --- a/guava/src/com/google/common/primitives/Floats.java +++ b/guava/src/com/google/common/primitives/Floats.java @@ -46,7 +46,7 @@ * @since 1.0 */ @GwtCompatible(emulated = true) -public final class Floats { +public final class Floats extends FloatsMethodsForWeb { private Floats() {} /** @@ -204,6 +204,8 @@ private static int lastIndexOf(float[] array, float target, int start, int end) * the array * @throws IllegalArgumentException if {@code array} is empty */ + @GwtIncompatible( + "Available in GWT! Annotation is to avoid conflict with GWT specialization of base class.") public static float min(float... array) { checkArgument(array.length > 0); float min = array[0]; @@ -222,6 +224,8 @@ public static float min(float... array) { * in the array * @throws IllegalArgumentException if {@code array} is empty */ + @GwtIncompatible( + "Available in GWT! Annotation is to avoid conflict with GWT specialization of base class.") public static float max(float... array) { checkArgument(array.length > 0); float max = array[0]; diff --git a/guava/src/com/google/common/primitives/FloatsMethodsForWeb.java b/guava/src/com/google/common/primitives/FloatsMethodsForWeb.java new file mode 100644 index 000000000000..acdb42f275b1 --- /dev/null +++ b/guava/src/com/google/common/primitives/FloatsMethodsForWeb.java @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2020 The Guava Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package com.google.common.primitives; + +import com.google.common.annotations.GwtCompatible; + +/** + * Holder for web specializations of methods of {@code Floats}. Intended to be empty for regular + * version. + */ +@GwtCompatible(emulated = true) +abstract class FloatsMethodsForWeb {} diff --git a/guava/src/com/google/common/primitives/Ints.java b/guava/src/com/google/common/primitives/Ints.java index bc61265e5603..ad8c8c123cf4 100644 --- a/guava/src/com/google/common/primitives/Ints.java +++ b/guava/src/com/google/common/primitives/Ints.java @@ -21,6 +21,7 @@ import com.google.common.annotations.Beta; import com.google.common.annotations.GwtCompatible; +import com.google.common.annotations.GwtIncompatible; import com.google.common.base.Converter; import java.io.Serializable; import java.util.AbstractList; @@ -44,8 +45,8 @@ * @author Kevin Bourrillion * @since 1.0 */ -@GwtCompatible -public final class Ints { +@GwtCompatible(emulated = true) +public final class Ints extends IntsMethodsForWeb { private Ints() {} /** @@ -220,6 +221,8 @@ private static int lastIndexOf(int[] array, int target, int start, int end) { * the array * @throws IllegalArgumentException if {@code array} is empty */ + @GwtIncompatible( + "Available in GWT! Annotation is to avoid conflict with GWT specialization of base class.") public static int min(int... array) { checkArgument(array.length > 0); int min = array[0]; @@ -239,6 +242,8 @@ public static int min(int... array) { * in the array * @throws IllegalArgumentException if {@code array} is empty */ + @GwtIncompatible( + "Available in GWT! Annotation is to avoid conflict with GWT specialization of base class.") public static int max(int... array) { checkArgument(array.length > 0); int max = array[0]; diff --git a/guava/src/com/google/common/primitives/IntsMethodsForWeb.java b/guava/src/com/google/common/primitives/IntsMethodsForWeb.java new file mode 100644 index 000000000000..cb87bd2929f8 --- /dev/null +++ b/guava/src/com/google/common/primitives/IntsMethodsForWeb.java @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2020 The Guava Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package com.google.common.primitives; + +import com.google.common.annotations.GwtCompatible; + +/** + * Holder for web specializations of methods of {@code Ints}. Intended to be empty for regular + * version. + */ +@GwtCompatible(emulated = true) +abstract class IntsMethodsForWeb {} diff --git a/guava/src/com/google/common/primitives/Shorts.java b/guava/src/com/google/common/primitives/Shorts.java index e0e727ebf7ad..fa480dd13ed9 100644 --- a/guava/src/com/google/common/primitives/Shorts.java +++ b/guava/src/com/google/common/primitives/Shorts.java @@ -44,7 +44,7 @@ * @since 1.0 */ @GwtCompatible(emulated = true) -public final class Shorts { +public final class Shorts extends ShortsMethodsForWeb { private Shorts() {} /** @@ -218,6 +218,8 @@ private static int lastIndexOf(short[] array, short target, int start, int end) * the array * @throws IllegalArgumentException if {@code array} is empty */ + @GwtIncompatible( + "Available in GWT! Annotation is to avoid conflict with GWT specialization of base class.") public static short min(short... array) { checkArgument(array.length > 0); short min = array[0]; @@ -237,6 +239,8 @@ public static short min(short... array) { * in the array * @throws IllegalArgumentException if {@code array} is empty */ + @GwtIncompatible( + "Available in GWT! Annotation is to avoid conflict with GWT specialization of base class.") public static short max(short... array) { checkArgument(array.length > 0); short max = array[0]; diff --git a/guava/src/com/google/common/primitives/ShortsMethodsForWeb.java b/guava/src/com/google/common/primitives/ShortsMethodsForWeb.java new file mode 100644 index 000000000000..c36276838cc6 --- /dev/null +++ b/guava/src/com/google/common/primitives/ShortsMethodsForWeb.java @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2020 The Guava Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing permissions and limitations under + * the License. + */ + +package com.google.common.primitives; + +import com.google.common.annotations.GwtCompatible; + +/** + * Holder for web specializations of methods of {@code Shorts}. Intended to be empty for regular + * version. + */ +@GwtCompatible(emulated = true) +abstract class ShortsMethodsForWeb {}