Package org.eclipse.jdt.debug.core

# Interface IJavaDebugTarget

All Superinterfaces:
  `IAdaptable`, `IBreakpointListener`, `IDebugElement`, `IDebugTarget`, `IDisconnect`, `IMemoryBlockRetrieval`, `IStepFilters`, `ISuspendResume`, `ITerminate`

public interface IJavaDebugTarget extends IDebugTarget, IStepFilters
A Java virtual machine.

See Also:
  - `IDebugTarget`
  - `IAdaptable`
Restriction:
  This interface is not intended to be implemented by clients.
Restriction:
  This interface is not intended to be extended by clients.

## Method Summary

Modifier and Type
Method
Description
`void`
`addHotCodeReplaceListener(IJavaHotCodeReplaceListener listener)`
Adds the given listener to this target for hot code replace notifications.
`IJavaVariable`
`findVariable(String variableName)`
Searches for and returns a variable with the given name, or `null` if unable to resolve a variable with the name.
`IJavaThreadGroup[]`
`getAllThreadGroups()`
Returns all thread groups in this target.
`String`
`getDefaultStratum()`
Return the default stratum used in this the target, or `null` to indicate a per-class default stratum.
`IJavaType[]`
`getJavaTypes(String name)`
Returns the types loaded in this debug target with the given fully qualified name, or `null` of no type with the given name is loaded.
`int`
`getRequestTimeout()`
Returns the timeout value for JDI requests in milliseconds, or -1 if not supported.
`IJavaThreadGroup[]`
`getRootThreadGroups()`
Returns the top level thread groups in this target.
`String[]`
`getStepFilters()`
Returns the list of active step filters in this target.
`String`
`getVersion()`
Returns the version of the underlying virtual machine as defined by the system property `java.version`.
`String`
`getVMName()`
Returns the name of the underlying virtual machine as defined by the system property `java.vm.name`.
`boolean`
`isFilterConstructors()`
Returns whether constructors are filtered when stepping, if step filters are enabled.
`boolean`
`isFilterGetters()`
Returns whether simple getters are filtered when stepping.
`boolean`
`isFilterSetters()`
Returns whether simple setters are filtered when stepping.
`boolean`
`isFilterStaticInitializers()`
Returns whether static initializers are filtered when stepping, if step filters are enabled.
`boolean`
`isFilterSynthetics()`
Returns whether synthetic methods are filtered when stepping, if step filters are enabled.
`boolean`
`isOutOfSynch()`
Returns whether any of the threads associated with this debug target are running code in the VM that is out of synch with the code in the workspace.
`boolean`
`isPerformingHotCodeReplace()`
Returns whether this target is currently performing a hot code replace.
`boolean`
`isStepThruFilters()`
Returns whether a step that lands in a filtered location should proceed through to an un-filtered location or return to the location where a step originated.
`boolean`
`mayBeOutOfSynch()`
Returns whether any of the threads associated with this debug target may be running code in the VM that is out of synch with the code in the workspace.
`IJavaValue`
`newValue(boolean value)`
Returns a value from this target that corresponds to the given boolean.
`IJavaValue`
`newValue(byte value)`
Returns a value from this target that corresponds to the given byte.
`IJavaValue`
`newValue(char value)`
Returns a value from this target that corresponds to the given char.
`IJavaValue`
`newValue(double value)`
Returns a value from this target that corresponds to the given double.
`IJavaValue`
`newValue(float value)`
Returns a value from this target that corresponds to the given float.
`IJavaValue`
`newValue(int value)`
Returns a value from this target that corresponds to the given int.
`IJavaValue`
`newValue(long value)`
Returns a value from this target that corresponds to the given long.
`IJavaValue`
`newValue(short value)`
Returns a value from this target that corresponds to the given short.
`IJavaValue`
`newValue(String value)`
Returns a value from this target that corresponds to the given string.
`IJavaValue`
`nullValue()`
Returns a value from this target that corresponds to `null`.
`void`
`refreshState()`
Refreshes the state of the Java debug model elements (client) with the current state of the debug target.
`void`
`removeHotCodeReplaceListener(IJavaHotCodeReplaceListener listener)`
Removes the given listener from this target.
`byte[]`
`sendCommand(byte commandSet, byte commandId, byte[] data)`
Sends a JDWP command to the back end and returns the JDWP reply packet as bytes.
`void`
`setDefaultStratum(String stratum)`
Set the default stratum used in this debug target.
`void`
`setFilterConstructors(boolean filter)`
Sets whether to filter constructors when stepping.
`void`
`setFilterGetters(boolean filter)`
Sets whether simple getters are filtered when stepping.
`void`
`setFilterSetters(boolean filter)`
Sets whether simple setters are filtered when stepping.
`void`
`setFilterStaticInitializers(boolean filter)`
Sets whether to filter static initializers when stepping.
`void`
`setFilterSynthetics(boolean filter)`
Sets whether synthetic methods are filtered when stepping.
`void`
`setRequestTimeout(int timeout)`
Sets the timeout value for JDI requests in milliseconds.
`void`
`setStepFilters(String[] list)`
Sets the list of active step filters in this target.
`void`
`setStepThruFilters(boolean thru)`
Sets whether a step that lands in a filtered location should continue through to an un-filtered location, or return to where the step originated.
`boolean`
`supportsAccessWatchpoints()`
Returns whether this target supports access watchpoints.
`boolean`
`supportsForceReturn()`
Returns whether this VM supports the ability to force an early return from methods.
`boolean`
`supportsHotCodeReplace()`
Returns whether this target supports hot code replace.
`boolean`
`supportsInstanceBreakpoints()`
Returns whether this target supports instance breakpoints.
`boolean`
`supportsInstanceRetrieval()`
Returns whether this VM supports instance and reference retrieval for types and objects.
`boolean`
`supportsModificationWatchpoints()`
Returns whether this target supports modification watchpoints.
`boolean`
`supportsMonitorInformation()`
Returns whether this target supports providing monitor information.
`boolean`
`supportsRequestTimeout()`
Returns whether this debug target supports a request timeout - a maximum time for a JDI request to receive a response.
`boolean`
`supportsSelectiveGarbageCollection()`
Returns whether this VM supports the ability to enable and disable garbage collection of individual objects.
`IJavaValue`
`voidValue()`
Returns a value from this target that corresponds to `void`.

### Methods inherited from interface org.eclipse.core.runtime.IAdaptable

`getAdapter`

### Methods inherited from interface org.eclipse.debug.core.IBreakpointListener

`breakpointAdded, breakpointChanged, breakpointRemoved`

### Methods inherited from interface org.eclipse.debug.core.model.IDebugElement

`getDebugTarget, getLaunch, getModelIdentifier`

### Methods inherited from interface org.eclipse.debug.core.model.IDebugTarget

`getName, getProcess, getThreads, hasThreads, supportsBreakpoint`

### Methods inherited from interface org.eclipse.debug.core.model.IDisconnect

`canDisconnect, disconnect, isDisconnected`

### Methods inherited from interface org.eclipse.debug.core.model.IMemoryBlockRetrieval

`getMemoryBlock, supportsStorageRetrieval`

### Methods inherited from interface org.eclipse.debug.core.model.IStepFilters

`isStepFiltersEnabled, setStepFiltersEnabled, supportsStepFilters`

### Methods inherited from interface org.eclipse.debug.core.model.ISuspendResume

`canResume, canSuspend, isSuspended, resume, suspend`

### Methods inherited from interface org.eclipse.debug.core.model.ITerminate

`canTerminate, isTerminated, terminate`

## Method Details

### findVariable

IJavaVariable findVariable(String variableName) throws DebugException
Searches for and returns a variable with the given name, or `null` if unable to resolve a variable with the name.

Variable lookup works only when a debug target has one or more threads suspended. Lookup is performed in each suspended thread, returning the first successful match, or `null` if no match if found. If this debug target has no suspended threads, `null` is returned.

Parameters:
  `variableName` - name of the variable
Returns:
  a variable with the given name, or `null` if none
Throws:
  `DebugException` - if this method fails. Reasons include:
  - Failure communicating with the VM. The DebugException's status code contains the underlying exception responsible for the failure.

### getJavaTypes

IJavaType[] getJavaTypes(String name) throws DebugException
Returns the types loaded in this debug target with the given fully qualified name, or `null` of no type with the given name is loaded.

Parameters:
  `name` - fully qualified name of type, for example `java.lang.String`
Returns:
  the types with the given name, or `null`
Throws:
  `DebugException` - if this method fails. Reasons include:
  - Failure communicating with the VM. The DebugException's status code contains the underlying exception responsible for the failure.

### newValue

IJavaValue newValue(boolean value)
Returns a value from this target that corresponds to the given boolean. The returned value can be used for setting and comparing against a value retrieved from this debug target.

Parameters:
  `value` - a boolean from which to create a value
Returns:
  a corresponding value from this target

### newValue

IJavaValue newValue(byte value)
Returns a value from this target that corresponds to the given byte. The returned value can be used for setting and comparing against a value retrieved from this debug target.

Parameters:
  `value` - a byte from which to create a value
Returns:
  a corresponding value from this target

### newValue

IJavaValue newValue(char value)
Returns a value from this target that corresponds to the given char. The returned value can be used for setting and comparing against a value retrieved from this debug target.

Parameters:
  `value` - a char from which to create a value
Returns:
  a corresponding value from this target

### newValue

IJavaValue newValue(double value)
Returns a value from this target that corresponds to the given double. The returned value can be used for setting and comparing against a value retrieved from this debug target.

Parameters:
  `value` - a double from which to create a value
Returns:
  a corresponding value from this target

### newValue

IJavaValue newValue(float value)
Returns a value from this target that corresponds to the given float. The returned value can be used for setting and comparing against a value retrieved from this debug target.

Parameters:
  `value` - a float from which to create a value
Returns:
  a corresponding value from this target

### newValue

IJavaValue newValue(int value)
Returns a value from this target that corresponds to the given int. The returned value can be used for setting and comparing against a value retrieved from this debug target.

Parameters:
  `value` - an int from which to create a value
Returns:
  a corresponding value from this target

### newValue

IJavaValue newValue(long value)
Returns a value from this target that corresponds to the given long. The returned value can be used for setting and comparing against a value retrieved from this debug target.

Parameters:
  `value` - a long from which to create a value
Returns:
  a corresponding value from this target

### newValue

IJavaValue newValue(short value)
Returns a value from this target that corresponds to the given short. The returned value can be used for setting and comparing against a value retrieved from this debug target.

Parameters:
  `value` - a short from which to create a value
Returns:
  a corresponding value from this target

### newValue

IJavaValue newValue(String value)
Returns a value from this target that corresponds to the given string. The returned value can be used for setting and comparing against a value retrieved from this debug target.

Parameters:
  `value` - a string from which to create a value
Returns:
  a corresponding value from this target

### nullValue

IJavaValue nullValue()
Returns a value from this target that corresponds to `null`. The returned value can be used for setting and comparing against a value retrieved from this debug target.

Returns:
  a value corresponding to `null`

### voidValue

IJavaValue voidValue()
Returns a value from this target that corresponds to `void`. The returned value can be used for setting and comparing against a value retrieved from this debug target.

Returns:
  a value corresponding to `void`

### isOutOfSynch

boolean isOutOfSynch() throws DebugException
Returns whether any of the threads associated with this debug target are running code in the VM that is out of synch with the code in the workspace.

Returns:
  whether this debug target is out of synch with the workspace.
Throws:
  `DebugException` - if this method fails. Reasons include:
  - Failure communicating with the VM. The DebugException's status code contains the underlying exception responsible for the failure.

### mayBeOutOfSynch

boolean mayBeOutOfSynch() throws DebugException
Returns whether any of the threads associated with this debug target may be running code in the VM that is out of synch with the code in the workspace.

Returns:
  whether this debug target may be out of synch with the workspace.
Throws:
  `DebugException` - if this method fails. Reasons include:
  - Failure communicating with the VM. The DebugException's status code contains the underlying exception responsible for the failure.

### supportsHotCodeReplace

boolean supportsHotCodeReplace()
Returns whether this target supports hot code replace.

Returns:
  whether this target supports hot code replace

### isPerformingHotCodeReplace

boolean isPerformingHotCodeReplace()
Returns whether this target is currently performing a hot code replace.

Returns:
  whether this target is currently performing a hot code replace
Since:
  2.1

### supportsInstanceBreakpoints

boolean supportsInstanceBreakpoints()
Returns whether this target supports instance breakpoints.

Returns:
  whether this target supports instance breakpoints
Since:
  2.1

### isFilterSynthetics

boolean isFilterSynthetics()
Returns whether synthetic methods are filtered when stepping, if step filters are enabled.

Returns:
  whether synthetic methods are filtered when stepping

### setFilterSynthetics

void setFilterSynthetics(boolean filter)
Sets whether synthetic methods are filtered when stepping.

Parameters:
  `filter` - whether to synthetic methods are filtered when stepping

### isFilterGetters

boolean isFilterGetters()
Returns whether simple getters are filtered when stepping.

Returns:
  true, if simple getters should be filtered when stepping
Since:
  3.7

### setFilterGetters

void setFilterGetters(boolean filter)
Sets whether simple getters are filtered when stepping.

Parameters:
  `filter` - whether to filter simple getters when stepping
Since:
  3.7

### isFilterSetters

boolean isFilterSetters()
Returns whether simple setters are filtered when stepping.

Returns:
  true, if simple setters should be filtered when stepping
Since:
  3.7

### setFilterSetters

void setFilterSetters(boolean filter)
Sets whether simple setters are filtered when stepping.

Parameters:
  `filter` - whether to filter simple setters when stepping
Since:
  3.7

### isFilterStaticInitializers

boolean isFilterStaticInitializers()
Returns whether static initializers are filtered when stepping, if step filters are enabled.

Returns:
  whether static initializers are filtered when stepping

### setFilterStaticInitializers

void setFilterStaticInitializers(boolean filter)
Sets whether to filter static initializers when stepping.

Parameters:
  `filter` - whether to filter static initializers when stepping

### isFilterConstructors

boolean isFilterConstructors()
Returns whether constructors are filtered when stepping, if step filters are enabled.

Returns:
  whether constructors are filtered when stepping

### setFilterConstructors

void setFilterConstructors(boolean filter)
Sets whether to filter constructors when stepping.

Parameters:
  `filter` - whether to filter constructors when stepping

### getStepFilters

String[] getStepFilters()
Returns the list of active step filters in this target. The list is a collection of Strings. Each string is the fully qualified name/pattern of a type/package to filter when stepping. For example `java.lang.*` or `java.lang.String`.

Returns:
  the list of active step filters, or `null`

### setStepFilters

void setStepFilters(String[] list)
Sets the list of active step filters in this target. The list is a collection of Strings. Each string is the fully qualified name/pattern of a type/package to filter when stepping. For example `java.lang.*` or `java.lang.String`.

Parameters:
  `list` - active step filters, or `null`

### setStepThruFilters

void setStepThruFilters(boolean thru)
Sets whether a step that lands in a filtered location should continue through to an un-filtered location, or return to where the step originated.

Parameters:
  `thru` - whether to step thru a filtered location or return to location where step originated
Since:
  3.5

### isStepThruFilters

boolean isStepThruFilters()
Returns whether a step that lands in a filtered location should proceed through to an un-filtered location or return to the location where a step originated.

Returns:
  whether a step that lands in a filtered location should proceed through to an un-filtered location or return to the location where a step originated
Since:
  3.5

### supportsRequestTimeout

boolean supportsRequestTimeout()
Returns whether this debug target supports a request timeout - a maximum time for a JDI request to receive a response. This option is only supported by the Eclipse JDI implementation.

Returns:
  whether this debug target supports a request timeout

### setRequestTimeout

void setRequestTimeout(int timeout)
Sets the timeout value for JDI requests in milliseconds. Has no effect if this target does not support a request timeout.

Parameters:
  `timeout` - the communication timeout, in milliseconds

### getRequestTimeout

int getRequestTimeout()
Returns the timeout value for JDI requests in milliseconds, or -1 if not supported.

Returns:
  timeout value, in milliseconds, or -1 if not supported

### supportsMonitorInformation

boolean supportsMonitorInformation()
Returns whether this target supports providing monitor information.

Returns:
  whether this target supports providing monitor information.
Since:
  2.1

### supportsAccessWatchpoints

boolean supportsAccessWatchpoints()
Returns whether this target supports access watchpoints.

Returns:
  whether this target supports access watchpoints
Since:
  3.0

### supportsModificationWatchpoints

boolean supportsModificationWatchpoints()
Returns whether this target supports modification watchpoints.

Returns:
  whether this target supports modification watchpoints
Since:
  3.0

### setDefaultStratum

void setDefaultStratum(String stratum)
Set the default stratum used in this debug target.

Parameters:
  `stratum` - the new default stratum, or `null` to indicate per-class default stratum
Since:
  3.0

### getDefaultStratum

String getDefaultStratum()
Return the default stratum used in this the target, or `null` to indicate a per-class default stratum.

Returns:
  the default stratum, or `null` to indicate a per-class default stratum
Since:
  3.0
See Also:
  - `setDefaultStratum(String)`

### getRootThreadGroups

IJavaThreadGroup[] getRootThreadGroups() throws DebugException
Returns the top level thread groups in this target. Top level thread groups do not have a parent.

Returns:
  top level thread groups
Throws:
  `DebugException` - if an exception occurs
Since:
  3.2

### getAllThreadGroups

IJavaThreadGroup[] getAllThreadGroups() throws DebugException
Returns all thread groups in this target.

Returns:
  all thread groups in this target
Throws:
  `DebugException` - if an exception occurs
Since:
  3.2

### supportsInstanceRetrieval

boolean supportsInstanceRetrieval()
Returns whether this VM supports instance and reference retrieval for types and objects.

Returns:
  whether this VM supports instance and reference retrieval for types and objects
Since:
  3.3

### supportsForceReturn

boolean supportsForceReturn()
Returns whether this VM supports the ability to force an early return from methods.

Returns:
  whether this VM can force an early return from methods
Since:
  3.3
See Also:
  - `IJavaThread`

### supportsSelectiveGarbageCollection

boolean supportsSelectiveGarbageCollection()
Returns whether this VM supports the ability to enable and disable garbage collection of individual objects.

Returns:
  whether this VM supports the ability to enable and disable garbage collection of individual objects
Since:
  3.4
See Also:
  - `IJavaObject`

### getVMName

String getVMName() throws DebugException
Returns the name of the underlying virtual machine as defined by the system property `java.vm.name`.

Returns:
  virtual machine name
Throws:
  `DebugException` - if retrieving the name fails
Since:
  3.4

### getVersion

String getVersion() throws DebugException
Returns the version of the underlying virtual machine as defined by the system property `java.version`.

Returns:
  `java.version` system property
Throws:
  `DebugException` - if retrieving the version property fails
Since:
  3.4

### refreshState

void refreshState() throws DebugException
Refreshes the state of the Java debug model elements (client) with the current state of the debug target.

For example, a `IJavaThread` may currently have a suspended state, but was somehow resumed on the target. Calling this method will causes all threads to update their state based on the current state of the target. Elements will fire debug events associated with any state changes. For example, a thread would fire a resume event if it discovered it was in a running state when it thought it was suspended.

Throws:
  `DebugException` - if an exception occurs
Since:
  3.6

### sendCommand

byte[] sendCommand(byte commandSet, byte commandId, byte[] data) throws DebugException
Sends a JDWP command to the back end and returns the JDWP reply packet as bytes. This method creates an appropriate command header and packet id, before sending to the back end.

Parameters:
  `commandSet` - command set identifier as defined by JDWP
  `commandId` - command identifier as defined by JDWP
  `data` - any bytes required for the command that follow the command header or `null` for commands that have no data
Returns:
  raw reply packet as bytes defined by JDWP
Throws:
  `DebugException` - if an error occurs sending the packet or receiving the reply
Since:
  3.6

### addHotCodeReplaceListener

void addHotCodeReplaceListener(IJavaHotCodeReplaceListener listener)
Adds the given listener to this target for hot code replace notifications. Has no effect if an identical listener is already registered.

When a hot code replace listener is added to a specific target, general hot code replace notifications via `JDIDebugModel` are not reported for that target. This allows a target to override general/default hot code replace listeners/handlers.

Parameters:
  `listener` - hot code replace listener
Since:
  3.6

### removeHotCodeReplaceListener

void removeHotCodeReplaceListener(IJavaHotCodeReplaceListener listener)
Removes the given listener from this target. Has no effect if an identical listener is not already registered.

Parameters:
  `listener` - hot code replace listener
Since:
  3.6