Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/com/sun/jdi/LocalVariable.java
38831 views
/*1* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package com.sun.jdi;2627/**28* A local variable in the target VM. Each variable declared within a29* {@link Method} has its own LocalVariable object. Variables of the same30* name declared in different scopes have different LocalVariable objects.31* LocalVariables can be used alone to retrieve static information32* about their declaration, or can be used in conjunction with a33* {@link StackFrame} to set and get values.34*35* @see StackFrame36* @see Method37*38* @author Robert Field39* @author Gordon Hirsch40* @author James McIlree41* @since 1.342*/4344@jdk.Exported45public interface LocalVariable extends Mirror, Comparable<LocalVariable> {4647/**48* Gets the name of the local variable.49*50* @return a string containing the name.51*/52String name();5354/**55* Returns a text representation of the type56* of this variable.57* Where the type is the type specified in the declaration58* of this local variable.59* <P>60* This type name is always available even if61* the type has not yet been created or loaded.62*63* @return a String representing the64* type of this local variable.6566*/67String typeName();6869/**70* Returns the type of this variable.71* Where the type is the type specified in the declaration72* of this local variable.73* <P>74* Note: if the type of this variable is a reference type (class,75* interface, or array) and it has not been created or loaded76* by the class loader of the enclosing class,77* then ClassNotLoadedException will be thrown.78* Also, a reference type may have been loaded but not yet prepared,79* in which case the type will be returned80* but attempts to perform some operations on the returned type81* (e.g. {@link ReferenceType#fields() fields()}) will throw82* a {@link ClassNotPreparedException}.83* Use {@link ReferenceType#isPrepared()} to determine if84* a reference type is prepared.85*86* @see Type87* @see Field#type() Field.type() - for usage examples88* @return the {@link Type} of this local variable.89* @throws ClassNotLoadedException if the type has not yet been loaded90* through the appropriate class loader.91*/92Type type() throws ClassNotLoadedException;9394/**95* Gets the JNI signature of the local variable.96*97* @see <a href="doc-files/signature.html">Type Signatures</a>98* @return a string containing the signature.99*/100String signature();101102/**103* Gets the generic signature for this variable if there is one.104* Generic signatures are described in the105* <cite>The Java™ Virtual Machine Specification</cite>.106*107* @return a string containing the generic signature, or <code>null</code>108* if there is no generic signature.109*110* @since 1.5111*/112String genericSignature();113114/**115* Determines whether this variable can be accessed from the given116* {@link StackFrame}.117*118* See {@link StackFrame#visibleVariables} for a complete description119* variable visibility in this interface.120*121* @param frame the StackFrame querying visibility122* @return <code>true</code> if this variable is visible;123* <code>false</code> otherwise.124* @throws IllegalArgumentException if the stack frame's method125* does not match this variable's method.126*/127boolean isVisible(StackFrame frame);128129/**130* Determines if this variable is an argument to its method.131*132* @return <code>true</code> if this variable is an argument;133* <code>false</code> otherwise.134*/135boolean isArgument();136137/**138* Compares the specified Object with this LocalVariable for equality.139*140* @return true if the Object is a LocalVariable, if both LocalVariables141* are contained in the same method (as determined by142* {@link Method#equals}), and if both LocalVariables mirror143* the same declaration within that method144*/145boolean equals(Object obj);146147/**148* Returns the hash code value for this LocalVariable.149*150* @return the integer hash code151*/152int hashCode();153}154155156