1.1 --- a/emul/src/main/java/java/lang/reflect/Array.java Fri Jan 18 21:51:06 2013 +0100
1.2 +++ b/emul/src/main/java/java/lang/reflect/Array.java Fri Jan 18 22:16:04 2013 +0100
1.3 @@ -188,8 +188,9 @@
1.4 */
1.5 public static Object get(Object array, int index)
1.6 throws IllegalArgumentException, ArrayIndexOutOfBoundsException {
1.7 - if (array.getClass().getComponentType().isPrimitive()) {
1.8 - throw new IllegalArgumentException();
1.9 + final Class<?> t = array.getClass().getComponentType();
1.10 + if (t.isPrimitive()) {
1.11 + return Array.fromPrimitive(t, array, index);
1.12 } else {
1.13 return ((Object[])array)[index];
1.14 }
1.15 @@ -649,4 +650,10 @@
1.16 }
1.17 return arr;
1.18 }
1.19 + private static Object fromPrimitive(Class<?> t, Object array, int index) {
1.20 + return Method.fromPrimitive(t, atArray(array, index));
1.21 + }
1.22 +
1.23 + @JavaScriptBody(args = { "array", "index" }, body = "return array[index]")
1.24 + private static native Object atArray(Object array, int index);
1.25 }