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 table illustrates which subinterfaces of Type 47 * are used to mirror types in the target VM -- 48 * <TABLE BORDER="1"> 49 * <CAPTION style="display:none">Maps each type declared in target to a mirrored 50 * instance of a subinterface of PrimitiveType or ReferenceType"</CAPTION> 51 * <TR style="background-color:#EEEEFF"> 52 * <TH id="primtype" colspan=3>Subinterfaces of {@link PrimitiveType}</TH> 53 * <TR style="background-color:#EEEEFF"> 54 * <TH id="declared" style="text-align:left" colspan=2>Type declared in target as</TH> 55 * <TH id="mirrored" style="text-align:left">Is mirrored as an instance of</TH> 56 * <TR> 57 * <TD headers="primtype declared" colspan=2><CODE>boolean</CODE></TD> 58 * <TD headers="primtype mirrored"> {@link BooleanType}</TD> 59 * <TR> 60 * <TD headers="primtype declared" colspan=2><CODE>byte</CODE></TD> 61 * <TD headers="primtype mirrored">{@link ByteType}</TD> 62 * <TR> 63 * <TD headers="primtype declared" colspan=2><CODE>char</CODE></TD> 64 * <TD headers="primtype mirrored">{@link CharType}</TD> 65 * <TR> 66 * <TD headers="primtype declared" colspan=2><CODE>double</CODE></TD> 67 * <TD headers="primtype mirrored">{@link DoubleType}</TD> 68 * <TR> 69 * <TD headers="primtype declared" colspan=2><CODE>float</CODE></TD> 70 * <TD headers="primtype mirrored">{@link FloatType}</TD> 71 * <TR> 72 * <TD headers="primtype declared" colspan=2><CODE>int</CODE></TD> 73 * <TD headers="primtype mirrored">{@link IntegerType}</TD> 74 * <TR> 75 * <TD headers="primtype declared" colspan=2><CODE>long</CODE></TD> 76 * <TD headers="primtype mirrored">{@link LongType}</TD> 77 * <TR> 78 * <TD headers="primtype declared" colspan=2><CODE>short</CODE></TD> 79 * <TD headers="primtype mirrored">{@link ShortType}</TD> 80 * <TR> 81 * <TD headers="primtype declared" colspan=2><CODE>void</CODE></TD> 82 * <TD headers="primtype mirrored">{@link VoidType}</TD> 83 * <TR style="background-color:#EEEEFF"> 84 * <TH id="reftype" colspan=3>Subinterfaces of {@link ReferenceType}</TH> 85 * <TR style="background-color:#EEEEFF"> 86 * <TH id="declared2"style="text-align:left">Type declared in target as</TH> 87 * <TH id="example2" style="text-align:left">For example</TH> 88 * <TH id="mirrored2" style="text-align:left">Is mirrored as an instance of</TH> 89 * <TR> 90 * <TD headers="reftype declared2"><I>a class</I></TD> 91 * <TD headers="reftype example2"><CODE>Date</CODE></TD> 92 * <TD headers="reftype mirrored2">{@link ClassType}</TD> 93 * <TR> 94 * <TD headers="reftype declared2"><I>an interface</I></TD> 95 * <TD headers="reftype example2"><CODE>Runnable</CODE></TD> 96 * <TD headers="reftype mirrored2">{@link InterfaceType}</TD> 97 * <TR> 98 * <TD headers="reftype declared2"><I>an array</I></TD> 99 * <TD headers="reftype example2"> </TD> 100 * <TD headers="reftype mirrored2">{@link ArrayType}</TD> 101 * <TR> 102 * <TD headers="reftype declared2"><I>an array</I></TD> 103 * <TD headers="reftype example2"><CODE>int[]</CODE></TD> 104 * <TD headers="reftype mirrored2">{@link ArrayType} whose 105 * {@link ArrayType#componentType() componentType()} is 106 * {@link IntegerType}</TD> 107 * <TR> 108 * <TD headers="reftype declared2"><I>an array</I></TD> 109 * <TD headers="reftype example2"><CODE>Date[]</CODE></TD> 110 * <TD headers="reftype mirrored2">{@link ArrayType} whose 111 * {@link ArrayType#componentType() componentType()} is 112 * {@link ClassType}</TD> 113 * <TR> 114 * <TD headers="reftype declared2"><I>an array</I></TD> 115 * <TD headers="reftype example2"><CODE>Runnable[]</CODE></TD> 116 * <TD headers="reftype mirrored2">{@link ArrayType} whose 117 * {@link ArrayType#componentType() componentType()} is 118 * {@link InterfaceType}</TD> 119 * </TABLE> 120 * 121 * @see PrimitiveType Subinterface PrimitiveType 122 * @see ReferenceType Subinterface ReferenceType 123 * @see Value Value - for relationship between Type and Value 124 * @see Field#type() Field.type() - for usage examples 125 * 126 * @author Robert Field 127 * @author Gordon Hirsch 128 * @author James McIlree 129 * @since 1.3 130 */ 131 public interface Type extends Mirror { 132 133 /** 134 * Returns the JNI-style signature for this type. 135 * <p> 136 * For primitive classes 137 * the returned signature is the signature of the corresponding primitive 138 * type; for example, "I" is returned as the signature of the class 139 * represented by {@link java.lang.Integer#TYPE}. 140 * 141 * @see <a href="doc-files/signature.html">Type Signatures</a> 142 * @return the string containing the type signature. 143 */ 144 String signature(); 145 146 /** 147 * @return a text representation of this type. 148 */ 149 String name(); 150 }