blob: 72aba0cd367ca97e4af6b5c8aa39ee7f5c930135 [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
2 * Copyright 1998-2003 Sun Microsystems, Inc. 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. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25
26package com.sun.jdi;
27
28import java.util.List;
29
30/**
31 * Provides access to the class of an array and the type of
32 * its components in the target VM.
33 *
34 * @see ArrayReference
35 *
36 * @author Robert Field
37 * @author Gordon Hirsch
38 * @author James McIlree
39 * @since 1.3
40 */
41public interface ArrayType extends ReferenceType {
42
43 /**
44 * Creates a new instance of this array class in the target VM.
45 * The array is created with the given length and each component
46 * is initialized to is standard default value.
47 *
48 * @param length the number of components in the new array
49 * @return the newly created {@link ArrayReference} mirroring
50 * the new object in the target VM.
51 *
52 * @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
53 */
54 ArrayReference newInstance(int length);
55
56 /**
57 * Gets the JNI signature of the components of this
58 * array class. The signature
59 * describes the declared type of the components. If the components
60 * are objects, their actual type in a particular run-time context
61 * may be a subclass of the declared class.
62 *
63 * @return a string containing the JNI signature of array components.
64 */
65 String componentSignature();
66
67 /**
68 * Returns a text representation of the component
69 * type of this array.
70 *
71 * @return a text representation of the component type.
72 */
73 String componentTypeName();
74
75 /**
76 * Returns the component type of this array,
77 * as specified in the array declaration.
78 * <P>
79 * Note: The component type of a array will always be
80 * created or loaded before the array - see the
81 * <a href="http://java.sun.com/docs/books/vmspec/">Java Virtual
82 * Machine Specification</a>, section
83 * <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ConstantPool.doc.html#79473">5.3.3
84 * Creating Array Classes</a>.
85 * However, although the component type will be loaded it may
86 * not yet be prepared, in which case the type will be returned
87 * but attempts to perform some operations on the returned type
88 * (e.g. {@link ReferenceType#fields() fields()}) will throw
89 * a {@link ClassNotPreparedException}.
90 * Use {@link ReferenceType#isPrepared()} to determine if
91 * a reference type is prepared.
92 *
93 * @see Type
94 * @see Field#type() Field.type() - for usage examples
95 * @return the {@link Type} of this array's components.
96 */
97 Type componentType() throws ClassNotLoadedException;
98}