Fix accidental boxing of byte in ArrayHelper.push. This regresion recently introduced and tests didn't catch it since JavaScript is very forgiving with coercions. PiperOrigin-RevId: 382679426 Change-Id: I40780b9a98d488661c533676f22b5a12557365c4
diff --git a/user/super/com/google/gwt/emul/javaemul/internal/ArrayHelper.java b/user/super/com/google/gwt/emul/javaemul/internal/ArrayHelper.java index 482fe9f..5d9086f 100644 --- a/user/super/com/google/gwt/emul/javaemul/internal/ArrayHelper.java +++ b/user/super/com/google/gwt/emul/javaemul/internal/ArrayHelper.java
@@ -15,6 +15,7 @@ */ package javaemul.internal; +import javaemul.internal.annotations.DoNotAutobox; import jsinterop.annotations.JsFunction; import jsinterop.annotations.JsMethod; import jsinterop.annotations.JsProperty; @@ -149,7 +150,7 @@ NativeArray(int length) {} - native void push(Object item); + native void push(@DoNotAutobox Object item); native Object[] slice();
diff --git a/user/test/com/google/gwt/emultest/java/lang/StringTest.java b/user/test/com/google/gwt/emultest/java/lang/StringTest.java index 4791200..59fe575 100644 --- a/user/test/com/google/gwt/emultest/java/lang/StringTest.java +++ b/user/test/com/google/gwt/emultest/java/lang/StringTest.java
@@ -20,6 +20,7 @@ import com.google.gwt.testing.TestUtils; import java.io.UnsupportedEncodingException; import java.nio.charset.Charset; +import java.util.Arrays; import java.util.Locale; /** @@ -421,6 +422,7 @@ for (int i = 0; i < str.length(); ++i) { assertEquals((byte) str.charAt(i), bytes[i]); } + assertTrue(Arrays.equals(bytes, str.getBytes())); } public void testGetBytesLatin1() throws UnsupportedEncodingException {