1 /* 2 * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package com.sun.jdi; 27 28 /** 29 * Provides access to the class of an array and the type of 30 * its components in the target VM. 31 * 32 * @see ArrayReference 33 * 34 * @author Robert Field 35 * @author Gordon Hirsch 36 * @author James McIlree 37 * @since 1.3 38 */ 39 public interface ArrayType extends ReferenceType { 40 41 /** 42 * Creates a new instance of this array class in the target VM. 43 * The array is created with the given length and each component 44 * is initialized to is standard default value. 45 * 46 * @param length the number of components in the new array 47 * @return the newly created {@link ArrayReference} mirroring 48 * the new object in the target VM. 49 * 50 * @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}. 51 */ 52 ArrayReference newInstance(int length); 53 54 /** 55 * Gets the JNI signature of the components of this 56 * array class. The signature 57 * describes the declared type of the components. If the components 58 * are objects, their actual type in a particular run-time context 59 * may be a subclass of the declared class. 60 * 61 * @return a string containing the JNI signature of array components. 62 */ 63 String componentSignature(); 64 65 /** 66 * Returns a text representation of the component 67 * type of this array. 68 * 69 * @return a text representation of the component type. 70 */ 71 String componentTypeName(); 72 73 /** 74 * Returns the component type of this array, 75 * as specified in the array declaration. 76 * <P> 77 * Note: The component type of a array will always be 78 * created or loaded before the array - see 79 * <cite>The Java Virtual Machine Specification</cite>, 80 * section 5.3.3 - Creating Array Classes. 81 * However, although the component type will be loaded it may 82 * not yet be prepared, in which case the type will be returned 83 * but attempts to perform some operations on the returned type 84 * (e.g. {@link ReferenceType#fields() fields()}) will throw 85 * a {@link ClassNotPreparedException}. 86 * Use {@link ReferenceType#isPrepared()} to determine if 87 * a reference type is prepared. 88 * 89 * @see Type 90 * @see Field#type() Field.type() - for usage examples 91 * @return the {@link Type} of this array's components. 92 */ 93 Type componentType() throws ClassNotLoadedException; 94 }