blob: 076d20b94275d7961c6fa265e47b109207260eea [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
2 * Copyright 1998-2001 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25
26package com.sun.jdi.request;
27
28import com.sun.jdi.*;
29
30/**
31 * Request for notification when an exception occurs in the target VM.
32 * When an enabled ExceptionRequest is satisfied, an
33 * {@link com.sun.jdi.event.EventSet event set} containing an
34 * {@link com.sun.jdi.event.ExceptionEvent ExceptionEvent} will be placed
35 * on the {@link com.sun.jdi.event.EventQueue EventQueue}.
36 * The collection of existing ExceptionRequests is
37 * managed by the {@link EventRequestManager}
38 *
39 * @see com.sun.jdi.event.ExceptionEvent
40 * @see com.sun.jdi.event.EventQueue
41 * @see EventRequestManager
42 *
43 * @author Robert Field
44 * @since 1.3
45 */
46public interface ExceptionRequest extends EventRequest {
47
48 /**
49 * Returns exception type for which exception events are requested.
50 * @return
51 * The exception (and its subclasses) requested
52 * with {@link EventRequestManager#createExceptionRequest}, or
53 * null if, as by default, all exceptions are requested.
54 */
55 ReferenceType exception();
56
57 /**
58 * Returns whether caught exceptions of the requested type
59 * will generate events when they are thrown.
60 * <p>
61 * Note that at the time an exception is thrown, it is not always
62 * possible to determine whether it is truly caught. See
63 * {@link com.sun.jdi.event.ExceptionEvent#catchLocation} for
64 * details.
65 * @return
66 * boolean true if caught exceptions will be reported, false
67 * otherwise.
68 */
69 boolean notifyCaught();
70
71 /**
72 * Returns whether uncaught exceptions of the requested type
73 * will generate events when they are thrown.
74 * <p>
75 * Note that at the time an exception is thrown, it is not always
76 * possible to determine whether it is truly uncaught. See
77 * {@link com.sun.jdi.event.ExceptionEvent#catchLocation} for
78 * details.
79 * @return
80 * boolean true if caught exceptions will be reported, false
81 * otherwise.
82 */
83 boolean notifyUncaught();
84
85 /**
86 * Restricts the events generated by this request to those in
87 * the given thread.
88 * @param thread the thread to filter on.
89 * @throws InvalidRequestStateException if this request is currently
90 * enabled or has been deleted.
91 * Filters may be added only to disabled requests.
92 */
93 void addThreadFilter(ThreadReference thread);
94
95 /**
96 * Restricts the events generated by this request to those whose
97 * location is in the given reference type or any of its subtypes.
98 * An event will be generated for any location in a reference type
99 * that can be safely cast to the given reference type.
100 *
101 * @param refType the reference type to filter on.
102 * @throws InvalidRequestStateException if this request is currently
103 * enabled or has been deleted.
104 * Filters may be added only to disabled requests.
105 */
106 void addClassFilter(ReferenceType refType);
107
108 /**
109 * Restricts the events generated by this request to those
110 * whose location is in a class whose name matches a restricted
111 * regular expression. Regular expressions are limited
112 * to exact matches and patterns that begin with '*' or end with '*';
113 * for example, "*.Foo" or "java.*".
114 *
115 * @param classPattern the pattern String to filter for.
116 * @throws InvalidRequestStateException if this request is currently
117 * enabled or has been deleted.
118 * Filters may be added only to disabled requests.
119 */
120 void addClassFilter(String classPattern);
121
122 /**
123 * Restricts the events generated by this request to those
124 * whose location is in a class whose name does <b>not</b> match a
125 * restricted regular expression. Regular expressions are limited
126 * to exact matches and patterns that begin with '*' or end with '*';
127 * for example, "*.Foo" or "java.*".
128 *
129 * @param classPattern the pattern String to filter against.
130 * @throws InvalidRequestStateException if this request is currently
131 * enabled or has been deleted.
132 * Filters may be added only to disabled requests.
133 */
134 void addClassExclusionFilter(String classPattern);
135
136 /**
137 * Restricts the events generated by this request to those in
138 * which the currently executing instance ("this") is the object
139 * specified.
140 * <P>
141 * Not all targets support this operation.
142 * Use {@link VirtualMachine#canUseInstanceFilters()}
143 * to determine if the operation is supported.
144 * @since 1.4
145 * @param instance the object which must be the current instance
146 * in order to pass this filter.
147 * @throws java.lang.UnsupportedOperationException if
148 * the target virtual machine does not support this
149 * operation.
150 * @throws InvalidRequestStateException if this request is currently
151 * enabled or has been deleted.
152 * Filters may be added only to disabled requests.
153 */
154 void addInstanceFilter(ObjectReference instance);
155}