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 * The mirror for a type in the target VM. 30 * This interface is the root of a type hierarchy encompassing primitive 31 * types and reference types. 32 * <P> 33 * A Type may be used to represent a run-time type: 34 * <BLOCKQUOTE> 35 * {@link Value}.type() 36 * </BLOCKQUOTE> 37 * or a compile-time type: 38 * <BLOCKQUOTE> 39 * {@link Field#type()} <BR> 40 * {@link Method#returnType()} <BR> 41 * {@link Method#argumentTypes()} <BR> 42 * {@link LocalVariable#type()} <BR> 43 * {@link ArrayType#componentType()} 44 * </BLOCKQUOTE> 45 * <P> 46 * The following tables illustrate which subinterfaces of Type 47 * are used to mirror types in the target VM -- 48 * <TABLE class="plain"> 49 * <CAPTION>Subinterfaces of {@link PrimitiveType}</CAPTION> 50 * <THEAD style="background-color:#EEEEFF; text-align:left"> 51 * <TR> 52 * <TH scope="col" style="width:25em">Type declared in target as</TH> 53 * <TH scope="col" style="width:20em">Is mirrored as an instance of</TH> 54 * </THEAD> 55 * <TBODY style="text-align:left"> 56 * <TR> 57 * <TH scope="row"><CODE>boolean</CODE></TH> 58 * <TD> {@link BooleanType}</TD> 59 * <TR> 60 * <TH scope="row"><CODE>byte</CODE></TH> 61 * <TD>{@link ByteType}</TD> 62 * <TR> 63 * <TH scope="row"><CODE>char</CODE></TH> 64 * <TD>{@link CharType}</TD> 65 * <TR> 66 * <TH scope="row"><CODE>double</CODE></TH> 67 * <TD>{@link DoubleType}</TD> 68 * <TR> 69 * <TH scope="row"><CODE>float</CODE></TH> 70 * <TD>{@link FloatType}</TD> 71 * <TR> 72 * <TH scope="row"><CODE>int</CODE></TH> 73 * <TD>{@link IntegerType}</TD> 74 * <TR> 75 * <TH scope="row"><CODE>long</CODE></TH> 76 * <TD>{@link LongType}</TD> 77 * <TR> 78 * <TH scope="row"><CODE>short</CODE></TH> 79 * <TD>{@link ShortType}</TD> 80 * <TR> 81 * <TH scope="row"><CODE>void</CODE></TH> 82 * <TD>{@link VoidType}</TD> 83 * </TBODY> 84 * </TABLE> 85 * 86 * <TABLE class="plain"> 87 * <CAPTION>Subinterfaces of {@link ReferenceType}</CAPTION> 88 * <THEAD style="background-color:#EEEEFF; text-align:left"> 89 * <TR> 90 * <TH scope="col" style="width:15em">Type declared in target as</TH> 91 * <TH scope="col" style="width:10em">For example</TH> 92 * <TH scope="col" style="width:20em">Is mirrored as an instance of</TH> 93 * </THEAD> 94 * <TBODY style="text-align:left"> 95 * <TR> 96 * <TH scope="row"><I>a class</I></TH> 97 * <TH scope="row"><CODE>Date</CODE></TH> 98 * <TD>{@link ClassType}</TD> 99 * <TR> 100 * <TH scope="row"><I>an interface</I></TH> 101 * <TH scope="row"><CODE>Runnable</CODE></TH> 102 * <TD>{@link InterfaceType}</TD> 103 * <TR> 104 * <TH scope="row" rowspan="4"><I>an array</I></TH> 105 * <TH scope="row"><i>(any)</i></TH> 106 * <TD>{@link ArrayType}</TD> 107 * <TR> 108 * <!--<TH scope="row"><I>an array</I></TH>--> 109 * <TH scope="row"><CODE>int[]</CODE></TH> 110 * <TD>{@link ArrayType} whose 111 * {@link ArrayType#componentType() componentType()} is 112 * {@link IntegerType}</TD> 113 * <TR> 114 * <!--<TH scope="row"><I>an array</I></TH>--> 115 * <TH scope="row"><CODE>Date[]</CODE></TH> 116 * <TD>{@link ArrayType} whose 117 * {@link ArrayType#componentType() componentType()} is 118 * {@link ClassType}</TD> 119 * <TR> 120 * <!--<TH scope="row"><I>an array</I></TH>--> 121 * <TH scope="row"><CODE>Runnable[]</CODE></TH> 122 * <TD>{@link ArrayType} whose 123 * {@link ArrayType#componentType() componentType()} is 124 * {@link InterfaceType}</TD> 125 * </TBODY> 126 * </TABLE> 127 * 128 * @see PrimitiveType Subinterface PrimitiveType 129 * @see ReferenceType Subinterface ReferenceType 130 * @see Value Value - for relationship between Type and Value 131 * @see Field#type() Field.type() - for usage examples 132 * 133 * @author Robert Field 134 * @author Gordon Hirsch 135 * @author James McIlree 136 * @since 1.3 137 */ 138 public interface Type extends Mirror { 139 140 /** 141 * Returns the JNI-style signature for this type. 142 * <p> 143 * For primitive classes 144 * the returned signature is the signature of the corresponding primitive 145 * type; for example, "I" is returned as the signature of the class 146 * represented by {@link java.lang.Integer#TYPE}. 147 * 148 * @see <a href="doc-files/signature.html">Type Signatures</a> 149 * @return the string containing the type signature. 150 */ 151 String signature(); 152 153 /** 154 * @return a text representation of this type. 155 */ 156 String name(); 157 }