Path: blob/master/src/jdk.jdi/share/classes/com/sun/jdi/LocalVariable.java
41159 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*/4344public interface LocalVariable extends Mirror, Comparable<LocalVariable> {4546/**47* Gets the name of the local variable.48*49* @return a string containing the name.50*/51String name();5253/**54* Returns a text representation of the type55* of this variable.56* Where the type is the type specified in the declaration57* of this local variable.58* <P>59* This type name is always available even if60* the type has not yet been created or loaded.61*62* @return a String representing the63* type of this local variable.6465*/66String typeName();6768/**69* Returns the type of this variable.70* Where the type is the type specified in the declaration71* of this local variable.72* <P>73* Note: if the type of this variable is a reference type (class,74* interface, or array) and it has not been created or loaded75* by the class loader of the enclosing class,76* then ClassNotLoadedException will be thrown.77* Also, a reference type may have been loaded but not yet prepared,78* in which case the type will be returned79* but attempts to perform some operations on the returned type80* (e.g. {@link ReferenceType#fields() fields()}) will throw81* a {@link ClassNotPreparedException}.82* Use {@link ReferenceType#isPrepared()} to determine if83* a reference type is prepared.84*85* @see Type86* @see Field#type() Field.type() - for usage examples87* @return the {@link Type} of this local variable.88* @throws ClassNotLoadedException if the type has not yet been loaded89* through the appropriate class loader.90*/91Type type() throws ClassNotLoadedException;9293/**94* Gets the <a href="{@docRoot}/../specs/jni/types.html#type-signatures">95* type signature</a> of the local variable.96*97* @return a string containing the signature.98*/99String signature();100101/**102* Gets the generic signature for this variable if there is one.103* Generic signatures are described in the104* <cite>The Java Virtual Machine Specification</cite>.105*106* @return a string containing the generic signature, or <code>null</code>107* if there is no generic signature.108*109* @since 1.5110*/111String genericSignature();112113/**114* Determines whether this variable can be accessed from the given115* {@link StackFrame}.116*117* See {@link StackFrame#visibleVariables} for a complete description118* variable visibility in this interface.119*120* @param frame the StackFrame querying visibility121* @return <code>true</code> if this variable is visible;122* <code>false</code> otherwise.123* @throws IllegalArgumentException if the stack frame's method124* does not match this variable's method.125*/126boolean isVisible(StackFrame frame);127128/**129* Determines if this variable is an argument to its method.130*131* @return <code>true</code> if this variable is an argument;132* <code>false</code> otherwise.133*/134boolean isArgument();135136/**137* Compares the specified Object with this LocalVariable for equality.138*139* @return true if the Object is a LocalVariable, if both LocalVariables140* are contained in the same method (as determined by141* {@link Method#equals}), and if both LocalVariables mirror142* the same declaration within that method143*/144boolean equals(Object obj);145146/**147* Returns the hash code value for this LocalVariable.148*149* @return the integer hash code150*/151int hashCode();152}153154155