src/java.base/share/classes/java/lang/reflect/Array.java
author jboes
Fri, 20 Sep 2019 11:07:52 +0100
changeset 58242 94bb65cb37d3
parent 47216 71c04702a3d5
permissions -rw-r--r--
8230648: Replace @exception tag with @throws in java.base Summary: Minor coding style update of javadoc tag in any file in java.base Reviewed-by: prappo, lancea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
     2
 * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package java.lang.reflect;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
31671
362e0c0acece 8076112: Add @HotSpotIntrinsicCandidate annotation to indicate methods for which Java Runtime has intrinsics
zmajo
parents: 25859
diff changeset
    28
import jdk.internal.HotSpotIntrinsicCandidate;
362e0c0acece 8076112: Add @HotSpotIntrinsicCandidate annotation to indicate methods for which Java Runtime has intrinsics
zmajo
parents: 25859
diff changeset
    29
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * The {@code Array} class provides static methods to dynamically create and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * access Java arrays.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * <p>{@code Array} permits widening conversions to occur during a get or set
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * operation, but throws an {@code IllegalArgumentException} if a narrowing
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * conversion would occur.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * @author Nakul Saraiya
45434
4582657c7260 8181082: class-level since tag issues in java.base & java.datatransfer module
mli
parents: 31671
diff changeset
    39
 * @since 1.1
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
public final
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
class Array {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
     * Constructor.  Class Array is not instantiable.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
    private Array() {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
     * Creates a new array with the specified component type and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
     * length.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
     * Invoking this method is equivalent to creating an array
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
     * as follows:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
     * <blockquote>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
     * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
     * int[] x = {length};
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
     * Array.newInstance(componentType, x);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
     * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
     * </blockquote>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     *
20769
01c5635d1d1a 7044282: (reflect) Class.forName and Array.newInstance are inconsistent regarding multidimensional arrays
jfranck
parents: 14342
diff changeset
    61
     * <p>The number of dimensions of the new array must not
01c5635d1d1a 7044282: (reflect) Class.forName and Array.newInstance are inconsistent regarding multidimensional arrays
jfranck
parents: 14342
diff changeset
    62
     * exceed 255.
01c5635d1d1a 7044282: (reflect) Class.forName and Array.newInstance are inconsistent regarding multidimensional arrays
jfranck
parents: 14342
diff changeset
    63
     *
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
    64
     * @param  componentType the {@code Class} object representing the
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
    65
     *         component type of the new array
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
    66
     * @param  length the length of the new array
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     * @return the new array
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
    68
     * @throws NullPointerException if the specified
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
    69
     *         {@code componentType} parameter is null
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
    70
     * @throws IllegalArgumentException if componentType is {@link
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
    71
     *         Void#TYPE} or if the number of dimensions of the requested array
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
    72
     *         instance exceed 255.
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
    73
     * @throws NegativeArraySizeException if the specified {@code length}
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
    74
     *         is negative
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    public static Object newInstance(Class<?> componentType, int length)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
        throws NegativeArraySizeException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
        return newArray(componentType, length);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     * Creates a new array
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     * with the specified component type and dimensions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     * If {@code componentType}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     * represents a non-array class or interface, the new array
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     * has {@code dimensions.length} dimensions and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     * {@code componentType} as its component type. If
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     * {@code componentType} represents an array class, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * number of dimensions of the new array is equal to the sum
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * of {@code dimensions.length} and the number of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     * dimensions of {@code componentType}. In this case, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     * component type of the new array is the component type of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     * {@code componentType}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     * <p>The number of dimensions of the new array must not
20769
01c5635d1d1a 7044282: (reflect) Class.forName and Array.newInstance are inconsistent regarding multidimensional arrays
jfranck
parents: 14342
diff changeset
    96
     * exceed 255.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     * @param componentType the {@code Class} object representing the component
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     * type of the new array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     * @param dimensions an array of {@code int} representing the dimensions of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     * the new array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * @return the new array
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   103
     * @throws    NullPointerException if the specified
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     * {@code componentType} argument is null
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   105
     * @throws    IllegalArgumentException if the specified {@code dimensions}
20769
01c5635d1d1a 7044282: (reflect) Class.forName and Array.newInstance are inconsistent regarding multidimensional arrays
jfranck
parents: 14342
diff changeset
   106
     * argument is a zero-dimensional array, if componentType is {@link
01c5635d1d1a 7044282: (reflect) Class.forName and Array.newInstance are inconsistent regarding multidimensional arrays
jfranck
parents: 14342
diff changeset
   107
     * Void#TYPE}, or if the number of dimensions of the requested array
01c5635d1d1a 7044282: (reflect) Class.forName and Array.newInstance are inconsistent regarding multidimensional arrays
jfranck
parents: 14342
diff changeset
   108
     * instance exceed 255.
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   109
     * @throws    NegativeArraySizeException if any of the components in
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     * the specified {@code dimensions} argument is negative.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    public static Object newInstance(Class<?> componentType, int... dimensions)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
        throws IllegalArgumentException, NegativeArraySizeException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
        return multiNewArray(componentType, dimensions);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     * Returns the length of the specified array object, as an {@code int}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     * @param array the array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     * @return the length of the array
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   122
     * @throws    IllegalArgumentException if the object argument is not
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     * an array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     */
31671
362e0c0acece 8076112: Add @HotSpotIntrinsicCandidate annotation to indicate methods for which Java Runtime has intrinsics
zmajo
parents: 25859
diff changeset
   125
    @HotSpotIntrinsicCandidate
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
    public static native int getLength(Object array)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
        throws IllegalArgumentException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     * Returns the value of the indexed component in the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     * array object.  The value is automatically wrapped in an object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     * if it has a primitive type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     * @param array the array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     * @param index the index
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     * @return the (possibly wrapped) value of the indexed component in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     * the specified array
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   138
     * @throws    NullPointerException If the specified object is null
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   139
     * @throws    IllegalArgumentException If the specified object is not
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     * an array
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   141
     * @throws    ArrayIndexOutOfBoundsException If the specified {@code index}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     * argument is negative, or if it is greater than or equal to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     * length of the specified array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
    public static native Object get(Object array, int index)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
        throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     * Returns the value of the indexed component in the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     * array object, as a {@code boolean}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
     * @param array the array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
     * @param index the index
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
     * @return the value of the indexed component in the specified array
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   155
     * @throws    NullPointerException If the specified object is null
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   156
     * @throws    IllegalArgumentException If the specified object is not
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     * an array, or if the indexed element cannot be converted to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     * return type by an identity or widening conversion
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   159
     * @throws    ArrayIndexOutOfBoundsException If the specified {@code index}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     * argument is negative, or if it is greater than or equal to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     * length of the specified array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
     * @see Array#get
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
    public static native boolean getBoolean(Object array, int index)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
        throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     * Returns the value of the indexed component in the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     * array object, as a {@code byte}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
     * @param array the array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     * @param index the index
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     * @return the value of the indexed component in the specified array
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   174
     * @throws    NullPointerException If the specified object is null
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   175
     * @throws    IllegalArgumentException If the specified object is not
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     * an array, or if the indexed element cannot be converted to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     * return type by an identity or widening conversion
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   178
     * @throws    ArrayIndexOutOfBoundsException If the specified {@code index}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     * argument is negative, or if it is greater than or equal to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     * length of the specified array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
     * @see Array#get
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
    public static native byte getByte(Object array, int index)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
        throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     * Returns the value of the indexed component in the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     * array object, as a {@code char}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     * @param array the array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     * @param index the index
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     * @return the value of the indexed component in the specified array
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   193
     * @throws    NullPointerException If the specified object is null
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   194
     * @throws    IllegalArgumentException If the specified object is not
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     * an array, or if the indexed element cannot be converted to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
     * return type by an identity or widening conversion
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   197
     * @throws    ArrayIndexOutOfBoundsException If the specified {@code index}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     * argument is negative, or if it is greater than or equal to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
     * length of the specified array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
     * @see Array#get
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    public static native char getChar(Object array, int index)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
        throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
     * Returns the value of the indexed component in the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     * array object, as a {@code short}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
     * @param array the array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
     * @param index the index
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     * @return the value of the indexed component in the specified array
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   212
     * @throws    NullPointerException If the specified object is null
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   213
     * @throws    IllegalArgumentException If the specified object is not
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     * an array, or if the indexed element cannot be converted to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
     * return type by an identity or widening conversion
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   216
     * @throws    ArrayIndexOutOfBoundsException If the specified {@code index}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     * argument is negative, or if it is greater than or equal to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
     * length of the specified array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
     * @see Array#get
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
    public static native short getShort(Object array, int index)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
        throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
     * Returns the value of the indexed component in the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
     * array object, as an {@code int}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
     * @param array the array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
     * @param index the index
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
     * @return the value of the indexed component in the specified array
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   231
     * @throws    NullPointerException If the specified object is null
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   232
     * @throws    IllegalArgumentException If the specified object is not
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     * an array, or if the indexed element cannot be converted to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     * return type by an identity or widening conversion
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   235
     * @throws    ArrayIndexOutOfBoundsException If the specified {@code index}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
     * argument is negative, or if it is greater than or equal to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
     * length of the specified array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
     * @see Array#get
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
    public static native int getInt(Object array, int index)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
        throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     * Returns the value of the indexed component in the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
     * array object, as a {@code long}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
     * @param array the array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
     * @param index the index
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
     * @return the value of the indexed component in the specified array
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   250
     * @throws    NullPointerException If the specified object is null
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   251
     * @throws    IllegalArgumentException If the specified object is not
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
     * an array, or if the indexed element cannot be converted to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
     * return type by an identity or widening conversion
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   254
     * @throws    ArrayIndexOutOfBoundsException If the specified {@code index}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
     * argument is negative, or if it is greater than or equal to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
     * length of the specified array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
     * @see Array#get
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
    public static native long getLong(Object array, int index)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
        throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
     * Returns the value of the indexed component in the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
     * array object, as a {@code float}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
     * @param array the array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
     * @param index the index
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
     * @return the value of the indexed component in the specified array
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   269
     * @throws    NullPointerException If the specified object is null
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   270
     * @throws    IllegalArgumentException If the specified object is not
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
     * an array, or if the indexed element cannot be converted to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
     * return type by an identity or widening conversion
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   273
     * @throws    ArrayIndexOutOfBoundsException If the specified {@code index}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
     * argument is negative, or if it is greater than or equal to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
     * length of the specified array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
     * @see Array#get
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
    public static native float getFloat(Object array, int index)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
        throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
     * Returns the value of the indexed component in the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
     * array object, as a {@code double}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
     * @param array the array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
     * @param index the index
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
     * @return the value of the indexed component in the specified array
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   288
     * @throws    NullPointerException If the specified object is null
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   289
     * @throws    IllegalArgumentException If the specified object is not
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
     * an array, or if the indexed element cannot be converted to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
     * return type by an identity or widening conversion
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   292
     * @throws    ArrayIndexOutOfBoundsException If the specified {@code index}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
     * argument is negative, or if it is greater than or equal to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
     * length of the specified array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
     * @see Array#get
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
    public static native double getDouble(Object array, int index)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
        throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
     * Sets the value of the indexed component of the specified array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
     * object to the specified new value.  The new value is first
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
     * automatically unwrapped if the array has a primitive component
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
     * type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
     * @param array the array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
     * @param index the index into the array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
     * @param value the new value of the indexed component
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   308
     * @throws    NullPointerException If the specified object argument
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
     * is null
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   310
     * @throws    IllegalArgumentException If the specified object argument
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
     * is not an array, or if the array component type is primitive and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
     * an unwrapping conversion fails
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   313
     * @throws    ArrayIndexOutOfBoundsException If the specified {@code index}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
     * argument is negative, or if it is greater than or equal to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
     * the length of the specified array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
    public static native void set(Object array, int index, Object value)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
        throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
     * Sets the value of the indexed component of the specified array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
     * object to the specified {@code boolean} value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
     * @param array the array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
     * @param index the index into the array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
     * @param z the new value of the indexed component
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   326
     * @throws    NullPointerException If the specified object argument
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
     * is null
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   328
     * @throws    IllegalArgumentException If the specified object argument
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
     * is not an array, or if the specified value cannot be converted
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
     * to the underlying array's component type by an identity or a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
     * primitive widening conversion
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   332
     * @throws    ArrayIndexOutOfBoundsException If the specified {@code index}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
     * argument is negative, or if it is greater than or equal to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
     * the length of the specified array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
     * @see Array#set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
    public static native void setBoolean(Object array, int index, boolean z)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
        throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
     * Sets the value of the indexed component of the specified array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
     * object to the specified {@code byte} value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
     * @param array the array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
     * @param index the index into the array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
     * @param b the new value of the indexed component
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   346
     * @throws    NullPointerException If the specified object argument
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
     * is null
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   348
     * @throws    IllegalArgumentException If the specified object argument
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
     * is not an array, or if the specified value cannot be converted
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
     * to the underlying array's component type by an identity or a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
     * primitive widening conversion
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   352
     * @throws    ArrayIndexOutOfBoundsException If the specified {@code index}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
     * argument is negative, or if it is greater than or equal to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
     * the length of the specified array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
     * @see Array#set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
    public static native void setByte(Object array, int index, byte b)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
        throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
     * Sets the value of the indexed component of the specified array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
     * object to the specified {@code char} value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
     * @param array the array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
     * @param index the index into the array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
     * @param c the new value of the indexed component
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   366
     * @throws    NullPointerException If the specified object argument
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
     * is null
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   368
     * @throws    IllegalArgumentException If the specified object argument
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
     * is not an array, or if the specified value cannot be converted
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
     * to the underlying array's component type by an identity or a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
     * primitive widening conversion
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   372
     * @throws    ArrayIndexOutOfBoundsException If the specified {@code index}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
     * argument is negative, or if it is greater than or equal to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
     * the length of the specified array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
     * @see Array#set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
    public static native void setChar(Object array, int index, char c)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
        throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
     * Sets the value of the indexed component of the specified array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
     * object to the specified {@code short} value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
     * @param array the array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
     * @param index the index into the array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
     * @param s the new value of the indexed component
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   386
     * @throws    NullPointerException If the specified object argument
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
     * is null
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   388
     * @throws    IllegalArgumentException If the specified object argument
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
     * is not an array, or if the specified value cannot be converted
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
     * to the underlying array's component type by an identity or a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
     * primitive widening conversion
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   392
     * @throws    ArrayIndexOutOfBoundsException If the specified {@code index}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
     * argument is negative, or if it is greater than or equal to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
     * the length of the specified array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
     * @see Array#set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
    public static native void setShort(Object array, int index, short s)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
        throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
     * Sets the value of the indexed component of the specified array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
     * object to the specified {@code int} value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
     * @param array the array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
     * @param index the index into the array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
     * @param i the new value of the indexed component
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   406
     * @throws    NullPointerException If the specified object argument
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
     * is null
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   408
     * @throws    IllegalArgumentException If the specified object argument
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
     * is not an array, or if the specified value cannot be converted
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
     * to the underlying array's component type by an identity or a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
     * primitive widening conversion
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   412
     * @throws    ArrayIndexOutOfBoundsException If the specified {@code index}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
     * argument is negative, or if it is greater than or equal to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
     * the length of the specified array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
     * @see Array#set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
    public static native void setInt(Object array, int index, int i)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
        throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
     * Sets the value of the indexed component of the specified array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
     * object to the specified {@code long} value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
     * @param array the array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
     * @param index the index into the array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
     * @param l the new value of the indexed component
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   426
     * @throws    NullPointerException If the specified object argument
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
     * is null
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   428
     * @throws    IllegalArgumentException If the specified object argument
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
     * is not an array, or if the specified value cannot be converted
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
     * to the underlying array's component type by an identity or a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
     * primitive widening conversion
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   432
     * @throws    ArrayIndexOutOfBoundsException If the specified {@code index}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
     * argument is negative, or if it is greater than or equal to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
     * the length of the specified array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
     * @see Array#set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
    public static native void setLong(Object array, int index, long l)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
        throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
     * Sets the value of the indexed component of the specified array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
     * object to the specified {@code float} value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
     * @param array the array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
     * @param index the index into the array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
     * @param f the new value of the indexed component
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   446
     * @throws    NullPointerException If the specified object argument
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
     * is null
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   448
     * @throws    IllegalArgumentException If the specified object argument
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
     * is not an array, or if the specified value cannot be converted
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
     * to the underlying array's component type by an identity or a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
     * primitive widening conversion
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   452
     * @throws    ArrayIndexOutOfBoundsException If the specified {@code index}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
     * argument is negative, or if it is greater than or equal to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
     * the length of the specified array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
     * @see Array#set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
    public static native void setFloat(Object array, int index, float f)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
        throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
     * Sets the value of the indexed component of the specified array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
     * object to the specified {@code double} value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
     * @param array the array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
     * @param index the index into the array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
     * @param d the new value of the indexed component
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   466
     * @throws    NullPointerException If the specified object argument
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
     * is null
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   468
     * @throws    IllegalArgumentException If the specified object argument
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
     * is not an array, or if the specified value cannot be converted
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
     * to the underlying array's component type by an identity or a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
     * primitive widening conversion
58242
94bb65cb37d3 8230648: Replace @exception tag with @throws in java.base
jboes
parents: 47216
diff changeset
   472
     * @throws    ArrayIndexOutOfBoundsException If the specified {@code index}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
     * argument is negative, or if it is greater than or equal to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
     * the length of the specified array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
     * @see Array#set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
    public static native void setDouble(Object array, int index, double d)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
        throws IllegalArgumentException, ArrayIndexOutOfBoundsException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
     * Private
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
31671
362e0c0acece 8076112: Add @HotSpotIntrinsicCandidate annotation to indicate methods for which Java Runtime has intrinsics
zmajo
parents: 25859
diff changeset
   484
    @HotSpotIntrinsicCandidate
10342
ca0984bc9d32 7077389: Reflection classes do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   485
    private static native Object newArray(Class<?> componentType, int length)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
        throws NegativeArraySizeException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
10342
ca0984bc9d32 7077389: Reflection classes do not build with javac -Xlint:all -Werror
jjg
parents: 5506
diff changeset
   488
    private static native Object multiNewArray(Class<?> componentType,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
        int[] dimensions)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
        throws IllegalArgumentException, NegativeArraySizeException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
}