Will replace direct manipulation with arrays with calls to java.lang.reflect.Array jdk7-b147
authorJaroslav Tulach <jaroslav.tulach@apidesign.org>
Fri, 18 Jan 2013 12:07:11 +0100
branchjdk7-b147
changeset 4751a61b103ac45
parent 417 b4c7e63733e8
child 476 c21c98f493bd
child 539 1831d3ddc7f0
Will replace direct manipulation with arrays with calls to java.lang.reflect.Array
emul/src/main/java/java/lang/NegativeArraySizeException.java
emul/src/main/java/java/lang/reflect/Array.java
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/emul/src/main/java/java/lang/NegativeArraySizeException.java	Fri Jan 18 12:07:11 2013 +0100
     1.3 @@ -0,0 +1,55 @@
     1.4 +/*
     1.5 + * Copyright (c) 1994, 2008, Oracle and/or its affiliates. All rights reserved.
     1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 + *
     1.8 + * This code is free software; you can redistribute it and/or modify it
     1.9 + * under the terms of the GNU General Public License version 2 only, as
    1.10 + * published by the Free Software Foundation.  Oracle designates this
    1.11 + * particular file as subject to the "Classpath" exception as provided
    1.12 + * by Oracle in the LICENSE file that accompanied this code.
    1.13 + *
    1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.17 + * version 2 for more details (a copy is included in the LICENSE file that
    1.18 + * accompanied this code).
    1.19 + *
    1.20 + * You should have received a copy of the GNU General Public License version
    1.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.23 + *
    1.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.25 + * or visit www.oracle.com if you need additional information or have any
    1.26 + * questions.
    1.27 + */
    1.28 +
    1.29 +package java.lang;
    1.30 +
    1.31 +/**
    1.32 + * Thrown if an application tries to create an array with negative size.
    1.33 + *
    1.34 + * @author  unascribed
    1.35 + * @since   JDK1.0
    1.36 + */
    1.37 +public
    1.38 +class NegativeArraySizeException extends RuntimeException {
    1.39 +    private static final long serialVersionUID = -8960118058596991861L;
    1.40 +
    1.41 +    /**
    1.42 +     * Constructs a <code>NegativeArraySizeException</code> with no
    1.43 +     * detail message.
    1.44 +     */
    1.45 +    public NegativeArraySizeException() {
    1.46 +        super();
    1.47 +    }
    1.48 +
    1.49 +    /**
    1.50 +     * Constructs a <code>NegativeArraySizeException</code> with the
    1.51 +     * specified detail message.
    1.52 +     *
    1.53 +     * @param   s   the detail message.
    1.54 +     */
    1.55 +    public NegativeArraySizeException(String s) {
    1.56 +        super(s);
    1.57 +    }
    1.58 +}
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/emul/src/main/java/java/lang/reflect/Array.java	Fri Jan 18 12:07:11 2013 +0100
     2.3 @@ -0,0 +1,485 @@
     2.4 +/*
     2.5 + * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
     2.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     2.7 + *
     2.8 + * This code is free software; you can redistribute it and/or modify it
     2.9 + * under the terms of the GNU General Public License version 2 only, as
    2.10 + * published by the Free Software Foundation.  Oracle designates this
    2.11 + * particular file as subject to the "Classpath" exception as provided
    2.12 + * by Oracle in the LICENSE file that accompanied this code.
    2.13 + *
    2.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    2.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    2.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    2.17 + * version 2 for more details (a copy is included in the LICENSE file that
    2.18 + * accompanied this code).
    2.19 + *
    2.20 + * You should have received a copy of the GNU General Public License version
    2.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    2.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    2.23 + *
    2.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    2.25 + * or visit www.oracle.com if you need additional information or have any
    2.26 + * questions.
    2.27 + */
    2.28 +
    2.29 +package java.lang.reflect;
    2.30 +
    2.31 +/**
    2.32 + * The {@code Array} class provides static methods to dynamically create and
    2.33 + * access Java arrays.
    2.34 + *
    2.35 + * <p>{@code Array} permits widening conversions to occur during a get or set
    2.36 + * operation, but throws an {@code IllegalArgumentException} if a narrowing
    2.37 + * conversion would occur.
    2.38 + *
    2.39 + * @author Nakul Saraiya
    2.40 + */
    2.41 +public final
    2.42 +class Array {
    2.43 +
    2.44 +    /**
    2.45 +     * Constructor.  Class Array is not instantiable.
    2.46 +     */
    2.47 +    private Array() {}
    2.48 +
    2.49 +    /**
    2.50 +     * Creates a new array with the specified component type and
    2.51 +     * length.
    2.52 +     * Invoking this method is equivalent to creating an array
    2.53 +     * as follows:
    2.54 +     * <blockquote>
    2.55 +     * <pre>
    2.56 +     * int[] x = {length};
    2.57 +     * Array.newInstance(componentType, x);
    2.58 +     * </pre>
    2.59 +     * </blockquote>
    2.60 +     *
    2.61 +     * @param componentType the {@code Class} object representing the
    2.62 +     * component type of the new array
    2.63 +     * @param length the length of the new array
    2.64 +     * @return the new array
    2.65 +     * @exception NullPointerException if the specified
    2.66 +     * {@code componentType} parameter is null
    2.67 +     * @exception IllegalArgumentException if componentType is {@link Void#TYPE}
    2.68 +     * @exception NegativeArraySizeException if the specified {@code length}
    2.69 +     * is negative
    2.70 +     */
    2.71 +    public static Object newInstance(Class<?> componentType, int length)
    2.72 +        throws NegativeArraySizeException {
    2.73 +        return newArray(componentType, length);
    2.74 +    }
    2.75 +
    2.76 +    /**
    2.77 +     * Creates a new array
    2.78 +     * with the specified component type and dimensions.
    2.79 +     * If {@code componentType}
    2.80 +     * represents a non-array class or interface, the new array
    2.81 +     * has {@code dimensions.length} dimensions and
    2.82 +     * {@code componentType} as its component type. If
    2.83 +     * {@code componentType} represents an array class, the
    2.84 +     * number of dimensions of the new array is equal to the sum
    2.85 +     * of {@code dimensions.length} and the number of
    2.86 +     * dimensions of {@code componentType}. In this case, the
    2.87 +     * component type of the new array is the component type of
    2.88 +     * {@code componentType}.
    2.89 +     *
    2.90 +     * <p>The number of dimensions of the new array must not
    2.91 +     * exceed the number of array dimensions supported by the
    2.92 +     * implementation (typically 255).
    2.93 +     *
    2.94 +     * @param componentType the {@code Class} object representing the component
    2.95 +     * type of the new array
    2.96 +     * @param dimensions an array of {@code int} representing the dimensions of
    2.97 +     * the new array
    2.98 +     * @return the new array
    2.99 +     * @exception NullPointerException if the specified
   2.100 +     * {@code componentType} argument is null
   2.101 +     * @exception IllegalArgumentException if the specified {@code dimensions}
   2.102 +     * argument is a zero-dimensional array, or if the number of
   2.103 +     * requested dimensions exceeds the limit on the number of array dimensions
   2.104 +     * supported by the implementation (typically 255), or if componentType
   2.105 +     * is {@link Void#TYPE}.
   2.106 +     * @exception NegativeArraySizeException if any of the components in
   2.107 +     * the specified {@code dimensions} argument is negative.
   2.108 +     */
   2.109 +    public static Object newInstance(Class<?> componentType, int... dimensions)
   2.110 +        throws IllegalArgumentException, NegativeArraySizeException {
   2.111 +        return multiNewArray(componentType, dimensions);
   2.112 +    }
   2.113 +
   2.114 +    /**
   2.115 +     * Returns the length of the specified array object, as an {@code int}.
   2.116 +     *
   2.117 +     * @param array the array
   2.118 +     * @return the length of the array
   2.119 +     * @exception IllegalArgumentException if the object argument is not
   2.120 +     * an array
   2.121 +     */
   2.122 +    public static native int getLength(Object array)
   2.123 +        throws IllegalArgumentException;
   2.124 +
   2.125 +    /**
   2.126 +     * Returns the value of the indexed component in the specified
   2.127 +     * array object.  The value is automatically wrapped in an object
   2.128 +     * if it has a primitive type.
   2.129 +     *
   2.130 +     * @param array the array
   2.131 +     * @param index the index
   2.132 +     * @return the (possibly wrapped) value of the indexed component in
   2.133 +     * the specified array
   2.134 +     * @exception NullPointerException If the specified object is null
   2.135 +     * @exception IllegalArgumentException If the specified object is not
   2.136 +     * an array
   2.137 +     * @exception ArrayIndexOutOfBoundsException If the specified {@code index}
   2.138 +     * argument is negative, or if it is greater than or equal to the
   2.139 +     * length of the specified array
   2.140 +     */
   2.141 +    public static native Object get(Object array, int index)
   2.142 +        throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
   2.143 +
   2.144 +    /**
   2.145 +     * Returns the value of the indexed component in the specified
   2.146 +     * array object, as a {@code boolean}.
   2.147 +     *
   2.148 +     * @param array the array
   2.149 +     * @param index the index
   2.150 +     * @return the value of the indexed component in the specified array
   2.151 +     * @exception NullPointerException If the specified object is null
   2.152 +     * @exception IllegalArgumentException If the specified object is not
   2.153 +     * an array, or if the indexed element cannot be converted to the
   2.154 +     * return type by an identity or widening conversion
   2.155 +     * @exception ArrayIndexOutOfBoundsException If the specified {@code index}
   2.156 +     * argument is negative, or if it is greater than or equal to the
   2.157 +     * length of the specified array
   2.158 +     * @see Array#get
   2.159 +     */
   2.160 +    public static native boolean getBoolean(Object array, int index)
   2.161 +        throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
   2.162 +
   2.163 +    /**
   2.164 +     * Returns the value of the indexed component in the specified
   2.165 +     * array object, as a {@code byte}.
   2.166 +     *
   2.167 +     * @param array the array
   2.168 +     * @param index the index
   2.169 +     * @return the value of the indexed component in the specified array
   2.170 +     * @exception NullPointerException If the specified object is null
   2.171 +     * @exception IllegalArgumentException If the specified object is not
   2.172 +     * an array, or if the indexed element cannot be converted to the
   2.173 +     * return type by an identity or widening conversion
   2.174 +     * @exception ArrayIndexOutOfBoundsException If the specified {@code index}
   2.175 +     * argument is negative, or if it is greater than or equal to the
   2.176 +     * length of the specified array
   2.177 +     * @see Array#get
   2.178 +     */
   2.179 +    public static native byte getByte(Object array, int index)
   2.180 +        throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
   2.181 +
   2.182 +    /**
   2.183 +     * Returns the value of the indexed component in the specified
   2.184 +     * array object, as a {@code char}.
   2.185 +     *
   2.186 +     * @param array the array
   2.187 +     * @param index the index
   2.188 +     * @return the value of the indexed component in the specified array
   2.189 +     * @exception NullPointerException If the specified object is null
   2.190 +     * @exception IllegalArgumentException If the specified object is not
   2.191 +     * an array, or if the indexed element cannot be converted to the
   2.192 +     * return type by an identity or widening conversion
   2.193 +     * @exception ArrayIndexOutOfBoundsException If the specified {@code index}
   2.194 +     * argument is negative, or if it is greater than or equal to the
   2.195 +     * length of the specified array
   2.196 +     * @see Array#get
   2.197 +     */
   2.198 +    public static native char getChar(Object array, int index)
   2.199 +        throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
   2.200 +
   2.201 +    /**
   2.202 +     * Returns the value of the indexed component in the specified
   2.203 +     * array object, as a {@code short}.
   2.204 +     *
   2.205 +     * @param array the array
   2.206 +     * @param index the index
   2.207 +     * @return the value of the indexed component in the specified array
   2.208 +     * @exception NullPointerException If the specified object is null
   2.209 +     * @exception IllegalArgumentException If the specified object is not
   2.210 +     * an array, or if the indexed element cannot be converted to the
   2.211 +     * return type by an identity or widening conversion
   2.212 +     * @exception ArrayIndexOutOfBoundsException If the specified {@code index}
   2.213 +     * argument is negative, or if it is greater than or equal to the
   2.214 +     * length of the specified array
   2.215 +     * @see Array#get
   2.216 +     */
   2.217 +    public static native short getShort(Object array, int index)
   2.218 +        throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
   2.219 +
   2.220 +    /**
   2.221 +     * Returns the value of the indexed component in the specified
   2.222 +     * array object, as an {@code int}.
   2.223 +     *
   2.224 +     * @param array the array
   2.225 +     * @param index the index
   2.226 +     * @return the value of the indexed component in the specified array
   2.227 +     * @exception NullPointerException If the specified object is null
   2.228 +     * @exception IllegalArgumentException If the specified object is not
   2.229 +     * an array, or if the indexed element cannot be converted to the
   2.230 +     * return type by an identity or widening conversion
   2.231 +     * @exception ArrayIndexOutOfBoundsException If the specified {@code index}
   2.232 +     * argument is negative, or if it is greater than or equal to the
   2.233 +     * length of the specified array
   2.234 +     * @see Array#get
   2.235 +     */
   2.236 +    public static native int getInt(Object array, int index)
   2.237 +        throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
   2.238 +
   2.239 +    /**
   2.240 +     * Returns the value of the indexed component in the specified
   2.241 +     * array object, as a {@code long}.
   2.242 +     *
   2.243 +     * @param array the array
   2.244 +     * @param index the index
   2.245 +     * @return the value of the indexed component in the specified array
   2.246 +     * @exception NullPointerException If the specified object is null
   2.247 +     * @exception IllegalArgumentException If the specified object is not
   2.248 +     * an array, or if the indexed element cannot be converted to the
   2.249 +     * return type by an identity or widening conversion
   2.250 +     * @exception ArrayIndexOutOfBoundsException If the specified {@code index}
   2.251 +     * argument is negative, or if it is greater than or equal to the
   2.252 +     * length of the specified array
   2.253 +     * @see Array#get
   2.254 +     */
   2.255 +    public static native long getLong(Object array, int index)
   2.256 +        throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
   2.257 +
   2.258 +    /**
   2.259 +     * Returns the value of the indexed component in the specified
   2.260 +     * array object, as a {@code float}.
   2.261 +     *
   2.262 +     * @param array the array
   2.263 +     * @param index the index
   2.264 +     * @return the value of the indexed component in the specified array
   2.265 +     * @exception NullPointerException If the specified object is null
   2.266 +     * @exception IllegalArgumentException If the specified object is not
   2.267 +     * an array, or if the indexed element cannot be converted to the
   2.268 +     * return type by an identity or widening conversion
   2.269 +     * @exception ArrayIndexOutOfBoundsException If the specified {@code index}
   2.270 +     * argument is negative, or if it is greater than or equal to the
   2.271 +     * length of the specified array
   2.272 +     * @see Array#get
   2.273 +     */
   2.274 +    public static native float getFloat(Object array, int index)
   2.275 +        throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
   2.276 +
   2.277 +    /**
   2.278 +     * Returns the value of the indexed component in the specified
   2.279 +     * array object, as a {@code double}.
   2.280 +     *
   2.281 +     * @param array the array
   2.282 +     * @param index the index
   2.283 +     * @return the value of the indexed component in the specified array
   2.284 +     * @exception NullPointerException If the specified object is null
   2.285 +     * @exception IllegalArgumentException If the specified object is not
   2.286 +     * an array, or if the indexed element cannot be converted to the
   2.287 +     * return type by an identity or widening conversion
   2.288 +     * @exception ArrayIndexOutOfBoundsException If the specified {@code index}
   2.289 +     * argument is negative, or if it is greater than or equal to the
   2.290 +     * length of the specified array
   2.291 +     * @see Array#get
   2.292 +     */
   2.293 +    public static native double getDouble(Object array, int index)
   2.294 +        throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
   2.295 +
   2.296 +    /**
   2.297 +     * Sets the value of the indexed component of the specified array
   2.298 +     * object to the specified new value.  The new value is first
   2.299 +     * automatically unwrapped if the array has a primitive component
   2.300 +     * type.
   2.301 +     * @param array the array
   2.302 +     * @param index the index into the array
   2.303 +     * @param value the new value of the indexed component
   2.304 +     * @exception NullPointerException If the specified object argument
   2.305 +     * is null
   2.306 +     * @exception IllegalArgumentException If the specified object argument
   2.307 +     * is not an array, or if the array component type is primitive and
   2.308 +     * an unwrapping conversion fails
   2.309 +     * @exception ArrayIndexOutOfBoundsException If the specified {@code index}
   2.310 +     * argument is negative, or if it is greater than or equal to
   2.311 +     * the length of the specified array
   2.312 +     */
   2.313 +    public static native void set(Object array, int index, Object value)
   2.314 +        throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
   2.315 +
   2.316 +    /**
   2.317 +     * Sets the value of the indexed component of the specified array
   2.318 +     * object to the specified {@code boolean} value.
   2.319 +     * @param array the array
   2.320 +     * @param index the index into the array
   2.321 +     * @param z the new value of the indexed component
   2.322 +     * @exception NullPointerException If the specified object argument
   2.323 +     * is null
   2.324 +     * @exception IllegalArgumentException If the specified object argument
   2.325 +     * is not an array, or if the specified value cannot be converted
   2.326 +     * to the underlying array's component type by an identity or a
   2.327 +     * primitive widening conversion
   2.328 +     * @exception ArrayIndexOutOfBoundsException If the specified {@code index}
   2.329 +     * argument is negative, or if it is greater than or equal to
   2.330 +     * the length of the specified array
   2.331 +     * @see Array#set
   2.332 +     */
   2.333 +    public static native void setBoolean(Object array, int index, boolean z)
   2.334 +        throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
   2.335 +
   2.336 +    /**
   2.337 +     * Sets the value of the indexed component of the specified array
   2.338 +     * object to the specified {@code byte} value.
   2.339 +     * @param array the array
   2.340 +     * @param index the index into the array
   2.341 +     * @param b the new value of the indexed component
   2.342 +     * @exception NullPointerException If the specified object argument
   2.343 +     * is null
   2.344 +     * @exception IllegalArgumentException If the specified object argument
   2.345 +     * is not an array, or if the specified value cannot be converted
   2.346 +     * to the underlying array's component type by an identity or a
   2.347 +     * primitive widening conversion
   2.348 +     * @exception ArrayIndexOutOfBoundsException If the specified {@code index}
   2.349 +     * argument is negative, or if it is greater than or equal to
   2.350 +     * the length of the specified array
   2.351 +     * @see Array#set
   2.352 +     */
   2.353 +    public static native void setByte(Object array, int index, byte b)
   2.354 +        throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
   2.355 +
   2.356 +    /**
   2.357 +     * Sets the value of the indexed component of the specified array
   2.358 +     * object to the specified {@code char} value.
   2.359 +     * @param array the array
   2.360 +     * @param index the index into the array
   2.361 +     * @param c the new value of the indexed component
   2.362 +     * @exception NullPointerException If the specified object argument
   2.363 +     * is null
   2.364 +     * @exception IllegalArgumentException If the specified object argument
   2.365 +     * is not an array, or if the specified value cannot be converted
   2.366 +     * to the underlying array's component type by an identity or a
   2.367 +     * primitive widening conversion
   2.368 +     * @exception ArrayIndexOutOfBoundsException If the specified {@code index}
   2.369 +     * argument is negative, or if it is greater than or equal to
   2.370 +     * the length of the specified array
   2.371 +     * @see Array#set
   2.372 +     */
   2.373 +    public static native void setChar(Object array, int index, char c)
   2.374 +        throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
   2.375 +
   2.376 +    /**
   2.377 +     * Sets the value of the indexed component of the specified array
   2.378 +     * object to the specified {@code short} value.
   2.379 +     * @param array the array
   2.380 +     * @param index the index into the array
   2.381 +     * @param s the new value of the indexed component
   2.382 +     * @exception NullPointerException If the specified object argument
   2.383 +     * is null
   2.384 +     * @exception IllegalArgumentException If the specified object argument
   2.385 +     * is not an array, or if the specified value cannot be converted
   2.386 +     * to the underlying array's component type by an identity or a
   2.387 +     * primitive widening conversion
   2.388 +     * @exception ArrayIndexOutOfBoundsException If the specified {@code index}
   2.389 +     * argument is negative, or if it is greater than or equal to
   2.390 +     * the length of the specified array
   2.391 +     * @see Array#set
   2.392 +     */
   2.393 +    public static native void setShort(Object array, int index, short s)
   2.394 +        throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
   2.395 +
   2.396 +    /**
   2.397 +     * Sets the value of the indexed component of the specified array
   2.398 +     * object to the specified {@code int} value.
   2.399 +     * @param array the array
   2.400 +     * @param index the index into the array
   2.401 +     * @param i the new value of the indexed component
   2.402 +     * @exception NullPointerException If the specified object argument
   2.403 +     * is null
   2.404 +     * @exception IllegalArgumentException If the specified object argument
   2.405 +     * is not an array, or if the specified value cannot be converted
   2.406 +     * to the underlying array's component type by an identity or a
   2.407 +     * primitive widening conversion
   2.408 +     * @exception ArrayIndexOutOfBoundsException If the specified {@code index}
   2.409 +     * argument is negative, or if it is greater than or equal to
   2.410 +     * the length of the specified array
   2.411 +     * @see Array#set
   2.412 +     */
   2.413 +    public static native void setInt(Object array, int index, int i)
   2.414 +        throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
   2.415 +
   2.416 +    /**
   2.417 +     * Sets the value of the indexed component of the specified array
   2.418 +     * object to the specified {@code long} value.
   2.419 +     * @param array the array
   2.420 +     * @param index the index into the array
   2.421 +     * @param l the new value of the indexed component
   2.422 +     * @exception NullPointerException If the specified object argument
   2.423 +     * is null
   2.424 +     * @exception IllegalArgumentException If the specified object argument
   2.425 +     * is not an array, or if the specified value cannot be converted
   2.426 +     * to the underlying array's component type by an identity or a
   2.427 +     * primitive widening conversion
   2.428 +     * @exception ArrayIndexOutOfBoundsException If the specified {@code index}
   2.429 +     * argument is negative, or if it is greater than or equal to
   2.430 +     * the length of the specified array
   2.431 +     * @see Array#set
   2.432 +     */
   2.433 +    public static native void setLong(Object array, int index, long l)
   2.434 +        throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
   2.435 +
   2.436 +    /**
   2.437 +     * Sets the value of the indexed component of the specified array
   2.438 +     * object to the specified {@code float} value.
   2.439 +     * @param array the array
   2.440 +     * @param index the index into the array
   2.441 +     * @param f the new value of the indexed component
   2.442 +     * @exception NullPointerException If the specified object argument
   2.443 +     * is null
   2.444 +     * @exception IllegalArgumentException If the specified object argument
   2.445 +     * is not an array, or if the specified value cannot be converted
   2.446 +     * to the underlying array's component type by an identity or a
   2.447 +     * primitive widening conversion
   2.448 +     * @exception ArrayIndexOutOfBoundsException If the specified {@code index}
   2.449 +     * argument is negative, or if it is greater than or equal to
   2.450 +     * the length of the specified array
   2.451 +     * @see Array#set
   2.452 +     */
   2.453 +    public static native void setFloat(Object array, int index, float f)
   2.454 +        throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
   2.455 +
   2.456 +    /**
   2.457 +     * Sets the value of the indexed component of the specified array
   2.458 +     * object to the specified {@code double} value.
   2.459 +     * @param array the array
   2.460 +     * @param index the index into the array
   2.461 +     * @param d the new value of the indexed component
   2.462 +     * @exception NullPointerException If the specified object argument
   2.463 +     * is null
   2.464 +     * @exception IllegalArgumentException If the specified object argument
   2.465 +     * is not an array, or if the specified value cannot be converted
   2.466 +     * to the underlying array's component type by an identity or a
   2.467 +     * primitive widening conversion
   2.468 +     * @exception ArrayIndexOutOfBoundsException If the specified {@code index}
   2.469 +     * argument is negative, or if it is greater than or equal to
   2.470 +     * the length of the specified array
   2.471 +     * @see Array#set
   2.472 +     */
   2.473 +    public static native void setDouble(Object array, int index, double d)
   2.474 +        throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
   2.475 +
   2.476 +    /*
   2.477 +     * Private
   2.478 +     */
   2.479 +
   2.480 +    private static native Object newArray(Class componentType, int length)
   2.481 +        throws NegativeArraySizeException;
   2.482 +
   2.483 +    private static native Object multiNewArray(Class componentType,
   2.484 +        int[] dimensions)
   2.485 +        throws IllegalArgumentException, NegativeArraySizeException;
   2.486 +
   2.487 +
   2.488 +}