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 }
2.1 --- a/emul/src/main/java/java/lang/reflect/Method.java Fri Jan 18 21:51:06 2013 +0100
2.2 +++ b/emul/src/main/java/java/lang/reflect/Method.java Fri Jan 18 22:16:04 2013 +0100
2.3 @@ -537,7 +537,7 @@
2.4 )
2.5 private static native Object invoke0(boolean isStatic, Method m, Object self, Object[] args);
2.6
2.7 - private static Object fromPrimitive(Class<?> type, Object o) {
2.8 + static Object fromPrimitive(Class<?> type, Object o) {
2.9 if (type == Integer.TYPE) {
2.10 return fromRaw(Integer.class, "valueOf__Ljava_lang_Integer_2I", o);
2.11 }