Interface Method
- All Superinterfaces:
- Accessible,- Comparable<Method>,- Locatable,- Mirror,- TypeComponent
TypeComponent
 for general information about Field and Method mirrors.- Since:
- 1.3
- See Also:
- 
Method SummaryModifier and TypeMethodDescriptionReturns a list containing aLocationobject for each executable source line in this method.allLineLocations(String stratum, String sourceName) Returns a list containing aLocationobject for each executable source line in this method.Returns a list containing eachLocalVariablethat is declared as an argument of this method.Returns a list containing a text representation of the type of each formal parameter of this method.Returns a list containing the type of each formal parameter of this method.byte[]Returns an array containing the bytecodes for this method.booleanCompares the specified Object with this method for equality.inthashCode()Returns the hash code value for this Method.booleanDetermine if this method is abstract.booleanisBridge()Determine if this method is a bridge method.booleanDetermine if this method is a constructor.default booleanDetermine if this method is a default methodbooleanisNative()Determine if this method is native.booleanDetermine if this method is obsolete.booleanDetermine if this method is a static initializer.booleanDetermine if this method is synchronized.booleanDetermine if this method accepts a variable number of arguments.location()Returns theLocationof this method, if there is executable code associated with it.locationOfCodeIndex(long codeIndex) Returns aLocationfor the given code index.locationsOfLine(int lineNumber) Returns a List containing allLocationobjects that map to the given line number.locationsOfLine(String stratum, String sourceName, int lineNumber) Returns a List containing allLocationobjects that map to the given line number and source name.Returns the return type, as specified in the declaration of this method.Returns a text representation of the return type, as specified in the declaration of this method.Returns a list containing eachLocalVariabledeclared in this method.variablesByName(String name) Returns a list containing eachLocalVariableof a given name in this method.Methods declared in interface com.sun.jdi.AccessibleisPackagePrivate, isPrivate, isProtected, isPublic, modifiersMethods declared in interface java.lang.ComparablecompareToMethods declared in interface com.sun.jdi.MirrortoString, virtualMachineMethods declared in interface com.sun.jdi.TypeComponentdeclaringType, genericSignature, isFinal, isStatic, isSynthetic, name, signature
- 
Method Details- 
returnTypeNameString returnTypeName()Returns a text representation of the return type, as specified in the declaration of this method.This type name is always available even if the type has not yet been created or loaded. - Returns:
- a Stringcontaining the return type name.
 
- 
returnTypeReturns the return type, as specified in the declaration of this method.Note: if the return type of this method is a reference type (class, interface, or array) and it has not been created or loaded by the declaring type's class loader - that is, declaringType().classLoader(), then ClassNotLoadedException will be thrown. Also, a reference type may have been loaded but not yet prepared, in which case the type will be returned but attempts to perform some operations on the returned type (e.g.fields()) will throw aClassNotPreparedException. UseReferenceType.isPrepared()to determine if a reference type is prepared.- Returns:
- the return Typeof this method.
- Throws:
- ClassNotLoadedException- if the type has not yet been created or loaded through the appropriate class loader.
- See Also:
 
- 
argumentTypeNamesReturns a list containing a text representation of the type of each formal parameter of this method.This list is always available even if the types have not yet been created or loaded. 
- 
argumentTypesReturns a list containing the type of each formal parameter of this method.Note: if there is any parameter whose type is a reference type (class, interface, or array) and it has not been created or loaded by the declaring type's class loader - that is, declaringType().classLoader(), then ClassNotLoadedException will be thrown. Also, a reference type may have been loaded but not yet prepared, in which case the list will be returned but attempts to perform some operations on the type (e.g.fields()) will throw aClassNotPreparedException. UseReferenceType.isPrepared()to determine if a reference type is prepared.- Returns:
- return a ListofType, one List element for each parameter of this method. Each element represents the type of a formal parameter as specified at compile-time. If the formal parameter was declared with an ellipsis, then it is represented as an array of the type before the ellipsis.
- Throws:
- ClassNotLoadedException- if the type has not yet been loaded through the appropriate class loader.
- See Also:
 
- 
isAbstractboolean isAbstract()Determine if this method is abstract.- Returns:
- trueif the method is declared abstract;- falseotherwise.
 
- 
isDefaultdefault boolean isDefault()Determine if this method is a default method- Returns:
- trueif the method is declared default;- falseotherwise.
- Since:
- 1.8
 
- 
isSynchronizedboolean isSynchronized()Determine if this method is synchronized.- Returns:
- trueif the method is declared synchronized;- falseotherwise.
 
- 
isNativeboolean isNative()Determine if this method is native.- Returns:
- trueif the method is declared native;- falseotherwise.
 
- 
isVarArgsboolean isVarArgs()Determine if this method accepts a variable number of arguments.- Returns:
- trueif the method accepts a variable number of arguments,- falseotherwise.
- Since:
- 1.5
 
- 
isBridgeboolean isBridge()Determine if this method is a bridge method. Bridge methods are defined in The Java Language Specification.- Returns:
- trueif the method is a bridge method,- falseotherwise.
- Since:
- 1.5
 
- 
isConstructorboolean isConstructor()Determine if this method is a constructor.- Returns:
- trueif the method is a constructor;- falseotherwise.
 
- 
isStaticInitializerboolean isStaticInitializer()Determine if this method is a static initializer.- Returns:
- trueif the method is a static initializer;- falseotherwise.
 
- 
isObsoleteboolean isObsolete()Determine if this method is obsolete.- Returns:
- trueif this method has been made obsolete by a- VirtualMachine.redefineClasses(java.util.Map<? extends com.sun.jdi.ReferenceType, byte[]>)operation.
- Since:
- 1.4
 
- 
allLineLocationsReturns a list containing aLocationobject for each executable source line in this method.This method is equivalent to allLineLocations(vm.getDefaultStratum(),null)- seeallLineLocations(String,String)for more information.- Returns:
- a List of all source line Locationobjects.
- Throws:
- AbsentInformationException- if there is no line number information for this (non-native, non-abstract) method.
 
- 
allLineLocationsList<Location> allLineLocations(String stratum, String sourceName) throws AbsentInformationException Returns a list containing aLocationobject for each executable source line in this method.Each location maps a source line to a range of code indices. The beginning of the range can be determined through Location.codeIndex(). The returned list is ordered by code index (from low to high).The returned list may contain multiple locations for a particular line number, if the compiler and/or VM has mapped that line to two or more disjoint code index ranges. If the method is native or abstract, an empty list is returned. Returned list is for the specified stratum (see Locationfor a description of strata).- Parameters:
- stratum- The stratum to retrieve information from or- nullfor the- ReferenceType.defaultStratum()
- sourceName- Return locations only within this source file or- nullto return locations.
- Returns:
- a List of all source line Locationobjects.
- Throws:
- AbsentInformationException- if there is no line number information for this (non-native, non-abstract) method. Or if sourceName is non-- nulland source name information is not present.
- Since:
- 1.4
 
- 
locationsOfLineReturns a List containing allLocationobjects that map to the given line number.This method is equivalent to locationsOfLine(vm.getDefaultStratum(), null, lineNumber)- seelocationsOfLine(java.lang.String,java.lang.String,int)for more information.- Parameters:
- lineNumber- the line number
- Returns:
- a List of Locationobjects that map to the given line number.
- Throws:
- AbsentInformationException- if there is no line number information for this method.
 
- 
locationsOfLineList<Location> locationsOfLine(String stratum, String sourceName, int lineNumber) throws AbsentInformationException Returns a List containing allLocationobjects that map to the given line number and source name.Returns a list containing each Locationthat maps to the given line. The returned list will contain a location for each disjoint range of code indices that have been assigned to the given line by the compiler and/or VM. Each returned location corresponds to the beginning of this range. An empty list will be returned if there is no executable code at the specified line number; specifically, native and abstract methods will always return an empty list.Returned list is for the specified stratum (see Locationfor a description of strata).- Parameters:
- stratum- the stratum to use for comparing line number and source name, or null to use the default stratum
- sourceName- the source name containing the line number, or null to match all source names
- lineNumber- the line number
- Returns:
- a List of Locationobjects that map to the given line number.
- Throws:
- AbsentInformationException- if there is no line number information for this method. Or if sourceName is non-- nulland source name information is not present.
- Since:
- 1.4
 
- 
locationOfCodeIndex
- 
variablesReturns a list containing eachLocalVariabledeclared in this method. The list includes any variable declared in any scope within the method. It may contain multiple variables of the same name declared within disjoint scopes. Arguments are considered local variables and will be present in the returned list. If local variable information is not available, values of actual arguments to method invocations can be obtained by using the methodStackFrame.getArgumentValues()- Returns:
- the list of LocalVariableobjects which mirror local variables declared in this method in the target VM. If there are no local variables, a zero-length list is returned.
- Throws:
- AbsentInformationException- if there is no variable information for this method. Generally, local variable information is not available for native or abstract methods (that is, their argument name information is not available), thus they will throw this exception.
 
- 
variablesByNameReturns a list containing eachLocalVariableof a given name in this method. Multiple variables can be returned if the same variable name is used in disjoint scopes within the method.- Returns:
- the list of LocalVariableobjects of the given name. If there are no matching local variables, a zero-length list is returned.
- Throws:
- AbsentInformationException- if there is no variable information for this method. Generally, local variable information is not available for native or abstract methods (that is, their argument name information is not available), thus they will throw this exception.
 
- 
argumentsReturns a list containing eachLocalVariablethat is declared as an argument of this method. If local variable information is not available, values of actual arguments to method invocations can be obtained by using the methodStackFrame.getArgumentValues()- Returns:
- the list of LocalVariablearguments. If there are no arguments, a zero-length list is returned.
- Throws:
- AbsentInformationException- if there is no variable information for this method. Generally, local variable information is not available for native or abstract methods (that is, their argument name information is not available), thus they will throw this exception.
 
- 
bytecodesbyte[] bytecodes()Returns an array containing the bytecodes for this method.Not all target virtual machines support this operation. Use VirtualMachine.canGetBytecodes()to determine if the operation is supported.- Returns:
- the array of bytecodes; abstract and native methods will return a zero-length array.
- Throws:
- UnsupportedOperationException- if the target virtual machine does not support the retrieval of bytecodes.
 
- 
location
- 
equalsCompares the specified Object with this method for equality.
- 
hashCode
 
-