Spec-Zone .ru
спецификации, руководства, описания, API
Java Debug Interface

com.sun.jdi
Interface Location

All Superinterfaces:
Comparable, Mirror

public interface Location
extends Mirror, Comparable

A point within the executing code of the target VM. Locations are used to identify the current position of a suspended thread (analogous to an instruction pointer or program counter register in native programs). They are also used to identify the position at which to set a breakpoint.

The availability of a line number for a location will depend on the level of debugging information available from the target VM.

Several mirror interfaces have locations. Each such mirror extends a Locatable interface.

Since:
1.3
See Also:
EventRequestManager, StackFrame, BreakpointEvent, ExceptionEvent, Locatable

Method Summary
 long codeIndex()
          Gets the code position within this location's method.
 ReferenceType declaringType()
          Gets the type to which this Location belongs.
 boolean equals(Object obj)
          Compares the specified Object with this Location for equality.
 int hashCode()
          Returns the hash code value for this Location.
 int lineNumber()
          The line number of this Location.
 Method method()
          Gets the method, if any, containing this Location.
 String sourceName()
          Gets an identifing name for the source corresponding to this location.
 
Methods inherited from interface com.sun.jdi.Mirror
toString, virtualMachine
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Method Detail

declaringType

public ReferenceType declaringType()
Gets the type to which this Location belongs. Normally the declaring type is a ClassType, but executable locations also may exist within the static initializer of an InterfaceType.
Returns:
the ReferenceType containing this Location.

method

public Method method()
Gets the method, if any, containing this Location.
Returns:
the Method if this location is in a method, otherwise null.

codeIndex

public long codeIndex()
Gets the code position within this location's method.
Returns:
the long representing the position within the method, or -1 if the method is native.

sourceName

public String sourceName()
                  throws AbsentInformationException
Gets an identifing name for the source corresponding to this location. Interpretation of this string is the responsibility of the source repository mechanism.

In the reference implementation, the returned string is the unqualified name of the source file for this Location.

Returns:
a string specifying the source
Throws:
AbsentInformationException - if the source name is not known

lineNumber

public int lineNumber()
The line number of this Location. The line number is relative to the source specified by sourceName().
Returns:
an int specifying the line in the source, return -1 if the information is not available.

equals

public boolean equals(Object obj)
Compares the specified Object with this Location for equality.
Overrides:
equals in class Object
Returns:
true if the Object is a Location and if it refers to the same point in the same VM as this Location.

hashCode

public int hashCode()
Returns the hash code value for this Location.
Overrides:
hashCode in class Object
Returns:
the integer hash code

Java Debug Interface