emul/src/main/java/java/lang/reflect/Array.java
branchArrayReflect
changeset 482 05a87bc23192
parent 480 dfebf4fbb711
child 483 7e39f344e4a0
     1.1 --- a/emul/src/main/java/java/lang/reflect/Array.java	Fri Jan 18 18:35:17 2013 +0100
     1.2 +++ b/emul/src/main/java/java/lang/reflect/Array.java	Fri Jan 18 19:22:49 2013 +0100
     1.3 @@ -159,8 +159,16 @@
     1.4       * @exception IllegalArgumentException if the object argument is not
     1.5       * an array
     1.6       */
     1.7 -    public static native int getLength(Object array)
     1.8 -        throws IllegalArgumentException;
     1.9 +    public static int getLength(Object array)
    1.10 +    throws IllegalArgumentException {
    1.11 +        if (!array.getClass().isArray()) {
    1.12 +            throw new IllegalArgumentException();
    1.13 +        }
    1.14 +        return length(array);
    1.15 +    }
    1.16 +    
    1.17 +    @JavaScriptBody(args = { "arr" }, body = "return arr.length;")
    1.18 +    private static native int length(Object arr);
    1.19  
    1.20      /**
    1.21       * Returns the value of the indexed component in the specified