jdk/src/jdk.jdi/share/classes/com/sun/jdi/ThreadReference.java
author clanger
Fri, 16 Jun 2017 14:09:31 +0200
changeset 45564 0149773a140c
parent 34894 3248b89d1921
permissions -rw-r--r--
8181417: Code cleanups in com.sun.jdi Reviewed-by: alanb, stuefe, sspitsyn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
45564
0149773a140c 8181417: Code cleanups in com.sun.jdi
clanger
parents: 34894
diff changeset
     2
 * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package com.sun.jdi;
45564
0149773a140c 8181417: Code cleanups in com.sun.jdi
clanger
parents: 34894
diff changeset
    27
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.util.List;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
45564
0149773a140c 8181417: Code cleanups in com.sun.jdi
clanger
parents: 34894
diff changeset
    30
import com.sun.jdi.event.EventSet;
0149773a140c 8181417: Code cleanups in com.sun.jdi
clanger
parents: 34894
diff changeset
    31
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * A thread object from the target VM.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * A ThreadReference is an {@link ObjectReference} with additional
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * access to thread-specific information from the target VM.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * @author Robert Field
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * @author Gordon Hirsch
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * @author James McIlree
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * @since  1.3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 */
20742
4ae78e8060d6 8008662: Add @jdk.Exported to JDK-specific/exported APIs
alanb
parents: 5506
diff changeset
    42
public interface ThreadReference extends ObjectReference {
45564
0149773a140c 8181417: Code cleanups in com.sun.jdi
clanger
parents: 34894
diff changeset
    43
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
    /** Thread status is unknown */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
    public final int THREAD_STATUS_UNKNOWN  =-1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
    /** Thread has completed execution */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
    public final int THREAD_STATUS_ZOMBIE = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
    /** Thread is runnable */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
    public final int THREAD_STATUS_RUNNING = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
    /** Thread is sleeping - Thread.sleep() or JVM_Sleep() was called */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
    public final int THREAD_STATUS_SLEEPING = 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
    /** Thread is waiting on a java monitor */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
    public final int THREAD_STATUS_MONITOR = 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    /** Thread is waiting - Object.wait() or JVM_MonitorWait() was called */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
    public final int THREAD_STATUS_WAIT = 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    /** Thread has not yet been started */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    public final int THREAD_STATUS_NOT_STARTED = 5;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     * Returns the name of this thread.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     * @return the string containing the thread name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    String name();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     * Suspends this thread. The thread can be resumed through
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     * {@link #resume} or resumed with other threads through
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     * {@link VirtualMachine#resume}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     * Unlike {@link java.lang.Thread#suspend},
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     * suspends of both the virtual machine and individual threads are
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     * counted. Before a thread will run again, it must be resumed
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     * (through {@link #resume} or {@link ThreadReference#resume})
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     * the same number of times it has been suspended.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     * Suspending single threads with this method has the same dangers
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     * as {@link java.lang.Thread#suspend()}. If the suspended thread
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     * holds a monitor needed by another running thread, deadlock is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     * possible in the target VM (at least until the suspended thread
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     * is resumed again).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     * The suspended thread is guaranteed to remain suspended until
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     * resumed through one of the JDI resume methods mentioned above;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     * the application in the target VM cannot resume the suspended thread
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     * through {@link java.lang.Thread#resume}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     * @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     */
45564
0149773a140c 8181417: Code cleanups in com.sun.jdi
clanger
parents: 34894
diff changeset
    89
    @SuppressWarnings("javadoc")
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
    void suspend();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     * Resumes this thread. If this thread was not previously suspended
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     * through {@link #suspend} or through {@link VirtualMachine#suspend},
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     * or because of a SUSPEND_ALL or SUSPEND_EVENT_THREAD event, then
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     * invoking this method has no effect. Otherwise, the count of pending
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     * suspends on this thread is decremented. If it is decremented to 0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     * the thread will continue to execute.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     * Note: the normal way to resume from an event related suspension is
45564
0149773a140c 8181417: Code cleanups in com.sun.jdi
clanger
parents: 34894
diff changeset
   100
     * via {@link EventSet#resume}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     * @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    void resume();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     * Returns the number of pending suspends for this thread. See
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     * {@link #suspend} for an explanation of counted suspends.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     * @return pending suspend count as an integer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
    int suspendCount();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     * Stops this thread with an asynchronous exception.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     * A debugger thread in the target VM will stop this thread
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     * with the given {@link java.lang.Throwable} object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     * @param throwable the asynchronous exception to throw.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     * @throws InvalidTypeException if <code>throwable</code> is not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     * an instance of java.lang.Throwable in the target VM.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     * @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     * @see java.lang.Thread#stop(Throwable)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     */
45564
0149773a140c 8181417: Code cleanups in com.sun.jdi
clanger
parents: 34894
diff changeset
   123
    @SuppressWarnings("javadoc")
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
    void stop(ObjectReference throwable) throws InvalidTypeException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     * Interrupts this thread unless the thread has been suspended by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     * debugger.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     * @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     * @see java.lang.Thread#interrupt()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
    void interrupt();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     * Returns the thread's status. If the thread is not suspended the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     * thread's current status is returned. If the thread is suspended, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     * thread's status before the suspension is returned (or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     * {@link #THREAD_STATUS_UNKNOWN} if this information is not available.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     * {@link #isSuspended} can be used to determine if the thread has been
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     * suspended.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     * @return one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
     * {@link #THREAD_STATUS_UNKNOWN},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     * {@link #THREAD_STATUS_ZOMBIE},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
     * {@link #THREAD_STATUS_RUNNING},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
     * {@link #THREAD_STATUS_SLEEPING},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
     * {@link #THREAD_STATUS_MONITOR},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     * {@link #THREAD_STATUS_WAIT},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     * {@link #THREAD_STATUS_NOT_STARTED},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
    int status();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     * Determines whether the thread has been suspended by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     * the debugger.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     * @return <code>true</code> if the thread is currently suspended;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     * <code>false</code> otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
    boolean isSuspended();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     * Determines whether the thread is suspended at a breakpoint.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     * @return <code>true</code> if the thread is currently stopped at
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     * a breakpoint; <code>false</code> otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
    boolean isAtBreakpoint();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     * Returns this thread's thread group.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     * @return a {@link ThreadGroupReference} that mirrors this thread's
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     * thread group in the target VM.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
    ThreadGroupReference threadGroup();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     * Returns the number of stack frames in the thread's current
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     * call stack.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
     * The thread must be suspended (normally through an interruption
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
     * to the VM) to get this information, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     * it is only valid until the thread is resumed again.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
     * @return an integer frame count
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
     * @throws IncompatibleThreadStateException if the thread is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     * not suspended in the target VM
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
    int frameCount() throws IncompatibleThreadStateException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     * Returns a List containing each {@link StackFrame} in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     * thread's current call stack.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     * The thread must be suspended (normally through an interruption
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     * to the VM) to get this information, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
     * it is only valid until the thread is resumed again.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     * @return a List of {@link StackFrame} with the current frame first
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
     * followed by each caller's frame.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
     * @throws IncompatibleThreadStateException if the thread is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
     * not suspended in the target VM
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
    List<StackFrame> frames() throws IncompatibleThreadStateException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
     * Returns the {@link StackFrame} at the given index in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     * thread's current call stack. Index 0 retrieves the current
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
     * frame; higher indices retrieve caller frames.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
     * The thread must be suspended (normally through an interruption
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
     * to the VM) to get this information, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     * it is only valid until the thread is resumed again.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     * @param index the desired frame
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     * @return the requested {@link StackFrame}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
     * @throws IncompatibleThreadStateException if the thread is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     * not suspended in the target VM
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     * @throws java.lang.IndexOutOfBoundsException if the index is greater than
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
     * or equal to {@link #frameCount} or is negative.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
    StackFrame frame(int index) throws IncompatibleThreadStateException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
     * Returns a List containing a range of {@link StackFrame} mirrors
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
     * from the thread's current call stack.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
     * The thread must be suspended (normally through an interruption
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
     * to the VM) to get this information, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
     * it is only valid until the thread is resumed again.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
     * @param start the index of the first frame to retrieve.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
     *       Index 0 represents the current frame.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
     * @param length the number of frames to retrieve
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     * @return a List of {@link StackFrame} with the current frame first
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     * followed by each caller's frame.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     * @throws IncompatibleThreadStateException if the thread is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     * not suspended in the target VM
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
     * @throws IndexOutOfBoundsException if the specified range is not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
     * within the range of stack frame indicies.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
     * That is, the exception is thrown if any of the following are true:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
     * <pre>    start &lt; 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     *    start &gt;= {@link #frameCount}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
     *    length &lt; 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     *    (start+length) &gt; {@link #frameCount}</pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
    List<StackFrame> frames(int start, int length)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
        throws IncompatibleThreadStateException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
     * Returns a List containing an {@link ObjectReference} for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
     * each monitor owned by the thread.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
     * A monitor is owned by a thread if it has been entered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
     * (via the synchronized statement or entry into a synchronized
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
     * method) and has not been relinquished through {@link Object#wait}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
     * Not all target virtual machines support this operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
     * Use {@link VirtualMachine#canGetOwnedMonitorInfo()}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
     * to determine if the operation is supported.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
     * @return a List of {@link ObjectReference} objects. The list
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
     * has zero length if no monitors are owned by this thread.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
     * @throws java.lang.UnsupportedOperationException if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
     * the target virtual machine does not support this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
     * operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
     * @throws IncompatibleThreadStateException if the thread is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
     * not suspended in the target VM
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
    List<ObjectReference> ownedMonitors()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
        throws IncompatibleThreadStateException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
     * Returns a List containing a {@link MonitorInfo} object for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
     * each monitor owned by the thread.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
     * A monitor is owned by a thread if it has been entered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
     * (via the synchronized statement or entry into a synchronized
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
     * method) and has not been relinquished through {@link Object#wait}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
     * Not all target virtual machines support this operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
     * Use {@link VirtualMachine#canGetMonitorFrameInfo()}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
     * to determine if the operation is supported.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
     * @return a List of {@link MonitorInfo} objects. The list
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
     * has zero length if no monitors are owned by this thread.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
     * @throws java.lang.UnsupportedOperationException if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
     * the target virtual machine does not support this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
     * operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
     * @throws IncompatibleThreadStateException if the thread is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
     * not suspended in the target VM
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
    List<MonitorInfo> ownedMonitorsAndFrames()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
        throws IncompatibleThreadStateException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
     * Returns an {@link ObjectReference} for the monitor, if any,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
     * for which this thread is currently waiting.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
     * The thread can be waiting for a monitor through entry into a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
     * synchronized method, the synchronized statement, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
     * {@link Object#wait}.  The {@link #status} method can be used
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
     * to differentiate between the first two cases and the third.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
     * Not all target virtual machines support this operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
     * Use {@link VirtualMachine#canGetCurrentContendedMonitor()}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
     * to determine if the operation is supported.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
     * @return the {@link ObjectReference} corresponding to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
     * contended monitor, or null if it is not waiting for a monitor.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
     * @throws java.lang.UnsupportedOperationException if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
     * the target virtual machine does not support this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
     * operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
     * @throws IncompatibleThreadStateException if the thread is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
     * not suspended in the target VM
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
    ObjectReference currentContendedMonitor() throws IncompatibleThreadStateException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
     * Pop stack frames.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
     * All frames up to and including the <CODE>frame</CODE> are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
     * popped off the stack.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
     * The frame previous to the parameter <CODE>frame</CODE>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
     * will become the current frame.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
     * After this operation, this thread will be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
     * suspended at the invoke instruction of the target method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
     * that created <CODE>frame</CODE>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
     * The <CODE>frame</CODE>'s method can be reentered with a step into
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
     * the instruction.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
     * The operand stack is restored, however, any changes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
     * to the arguments that occurred in the called method, remain.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
     * For example, if the method <CODE>foo</CODE>:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
     * <PRE>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
     *    void foo(int x) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
     *        System.out.println("Foo: " + x);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
     *        x = 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
     *        System.out.println("pop here");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
     *    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
     * </PRE>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
     * was called with <CODE>foo(7)</CODE> and <CODE>foo</CODE>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
     * is popped at the second <CODE>println</CODE> and resumed,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
     * it will print: <CODE>Foo: 4</CODE>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
     * Locks acquired by a popped frame are released when it
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
     * is popped. This applies to synchronized methods that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
     * are popped, and to any synchronized blocks within them.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
     * Finally blocks are not executed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
     * No aspect of state, other than this thread's execution point and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
     * locks, is affected by this call.  Specifically, the values of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
     * fields are unchanged, as are external resources such as
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
     * I/O streams.  Additionally, the target program might be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
     * placed in a state that is impossible with normal program flow;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
     * for example, order of lock acquisition might be perturbed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
     * Thus the target program may
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
     * proceed differently than the user would expect.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
     * The specified thread must be suspended.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
     * All <code>StackFrame</code> objects for this thread are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
     * invalidated.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
     * No events are generated by this method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
     * None of the frames through and including the frame for the caller
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
     * of <i>frame</i> may be native.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
     * Not all target virtual machines support this operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
     * Use {@link VirtualMachine#canPopFrames() VirtualMachine.canPopFrames()}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
     * to determine if the operation is supported.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
     * @param frame Stack frame to pop.  <CODE>frame</CODE> is on this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
     * thread's call stack.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
     * @throws java.lang.UnsupportedOperationException if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
     * the target virtual machine does not support this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
     * operation - see
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
     * {@link VirtualMachine#canPopFrames() VirtualMachine.canPopFrames()}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
     * @throws IncompatibleThreadStateException if this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
     * thread is not suspended.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
     * @throws java.lang.IllegalArgumentException if <CODE>frame</CODE>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
     * is not on this thread's call stack.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
     * @throws NativeMethodException if one of the frames that would be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
     * popped is that of a native method or if the frame previous to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
     * <i>frame</i> is native.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
     * @throws InvalidStackFrameException if <CODE>frame</CODE> has become
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
     * invalid. Once this thread is resumed, the stack frame is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
     * no longer valid.  This exception is also thrown if there are no
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
     * more frames.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
     * @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
     * @since 1.4 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
    void popFrames(StackFrame frame) throws IncompatibleThreadStateException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
     * Force a method to return before it reaches a return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
     * statement.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
     * The method which will return early is referred to as the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
     * called method. The called method is the current method (as
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
     * defined by the Frames section in the Java Virtual Machine
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
     * Specification) for the specified thread at the time this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
     * method is called.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
     * The thread must be suspended.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
     * The return occurs when execution of Java programming
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
     * language code is resumed on this thread. Between the call to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
     * this method and resumption of thread execution, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
     * state of the stack is undefined.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
     * No further instructions are executed in the called
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
     * method. Specifically, finally blocks are not executed. Note:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
     * this can cause inconsistent states in the application.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
     * A lock acquired by calling the called method (if it is a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
     * synchronized method) and locks acquired by entering
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
     * synchronized blocks within the called method are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
     * released. Note: this does not apply to native locks or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
     * java.util.concurrent.locks locks.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
     * Events, such as MethodExit, are generated as they would be in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
     * a normal return.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
     * The called method must be a non-native Java programming
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
     * language method. Forcing return on a thread with only one
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
     * frame on the stack causes the thread to exit when resumed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
     * The <code>value</code> argument is the value that the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
     * method is to return.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
     * If the return type of the method is void, then value must
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
     * be a  {@link VoidValue VoidValue}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
     * Object values must be assignment compatible with the method return type
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
     * (This implies that the method return type must be loaded through the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
     * enclosing class's class loader). Primitive values must be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
     * either assignment compatible with the method return type or must be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
     * convertible to the variable type without loss of information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
     * See JLS section 5.2 for more information on assignment
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
     * compatibility.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
     * Not all target virtual machines support this operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
     * Use {@link VirtualMachine#canForceEarlyReturn()}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
     * to determine if the operation is supported.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
     * @param value the value the method is to return.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
     * @throws java.lang.UnsupportedOperationException if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
     * the target virtual machine does not support this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
     * operation - see
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
     * {@link VirtualMachine#canGetInstanceInfo() canForceEarlyReturn()}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
     * @throws IncompatibleThreadStateException if this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
     * thread is not suspended.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
     * @throws NativeMethodException if the frame to be returned from
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
     * is that of a native method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
     * @throws InvalidStackFrameException if there are no frames.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
     * @throws InvalidTypeException if the value's type does not match
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
     * the method's return type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
     * @throws ClassNotLoadedException if the method's return type has not yet
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
     * been loaded through the appropriate class loader.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
     * @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
    void forceEarlyReturn(Value value) throws InvalidTypeException,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
                                              ClassNotLoadedException,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
                                              IncompatibleThreadStateException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
}