Mercurial > hg > truffle
comparison graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Debug.java @ 14624:f3510d0dcf67
removed use of varargs from Debug.scope() API
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 19 Mar 2014 23:11:39 +0100 |
parents | a0baf4eeb018 |
children | 3ab42370f636 |
comparison
equal
deleted
inserted
replaced
14623:5507d2f586ef | 14624:f3510d0dcf67 |
---|---|
128 return callable; | 128 return callable; |
129 } | 129 } |
130 | 130 |
131 /** | 131 /** |
132 * Gets a string composed of the names in the current nesting of debug | 132 * Gets a string composed of the names in the current nesting of debug |
133 * {@linkplain #scope(String, Object...) scopes} separated by {@code '.'}. | 133 * {@linkplain #scope(Object) scopes} separated by {@code '.'}. |
134 */ | 134 */ |
135 public static String currentScope() { | 135 public static String currentScope() { |
136 if (ENABLED) { | 136 if (ENABLED) { |
137 return DebugScope.getInstance().getQualifiedName(); | 137 return DebugScope.getInstance().getQualifiedName(); |
138 } else { | 138 } else { |
139 return ""; | 139 return ""; |
140 } | 140 } |
141 } | 141 } |
142 | 142 |
143 /** | 143 /** |
144 * Represents a debug scope entered by {@link Debug#scope(String, Object...)} or | 144 * Represents a debug scope entered by {@link Debug#scope(Object)} or |
145 * {@link Debug#sandbox(String, DebugConfig, Object...)}. Leaving the scope is achieved via | 145 * {@link Debug#sandbox(String, DebugConfig, Object...)}. Leaving the scope is achieved via |
146 * {@link #close()}. | 146 * {@link #close()}. |
147 */ | 147 */ |
148 public interface Scope extends AutoCloseable { | 148 public interface Scope extends AutoCloseable { |
149 void close(); | 149 void close(); |
172 * java.lang.Class | arg.getSimpleName() | 172 * java.lang.Class | arg.getSimpleName() |
173 * | | 173 * | |
174 * </pre> | 174 * </pre> |
175 * | 175 * |
176 * @param name the name of the new scope | 176 * @param name the name of the new scope |
177 * @param context objects to be appended to the {@linkplain #context() current} debug context | |
178 * @return the scope entered by this method which will be exited when its {@link Scope#close()} | 177 * @return the scope entered by this method which will be exited when its {@link Scope#close()} |
179 * method is called | 178 * method is called |
180 */ | 179 */ |
181 public static Scope scope(Object name, Object... context) { | 180 public static Scope scope(Object name) { |
181 if (ENABLED) { | |
182 return DebugScope.getInstance().scope(convertFormatArg(name).toString(), null); | |
183 } else { | |
184 return null; | |
185 } | |
186 } | |
187 | |
188 /** | |
189 * @see #scope(Object) | |
190 * @param context an object to be appended to the {@linkplain #context() current} debug context | |
191 */ | |
192 public static Scope scope(Object name, Object context) { | |
182 if (ENABLED) { | 193 if (ENABLED) { |
183 return DebugScope.getInstance().scope(convertFormatArg(name).toString(), null, context); | 194 return DebugScope.getInstance().scope(convertFormatArg(name).toString(), null, context); |
195 } else { | |
196 return null; | |
197 } | |
198 } | |
199 | |
200 /** | |
201 * @see #scope(Object) | |
202 * @param context1 first object to be appended to the {@linkplain #context() current} debug | |
203 * context | |
204 * @param context2 second object to be appended to the {@linkplain #context() current} debug | |
205 * context | |
206 */ | |
207 public static Scope scope(Object name, Object context1, Object context2) { | |
208 if (ENABLED) { | |
209 return DebugScope.getInstance().scope(convertFormatArg(name).toString(), null, context1, context2); | |
210 } else { | |
211 return null; | |
212 } | |
213 } | |
214 | |
215 /** | |
216 * @see #scope(Object) | |
217 * @param context1 first object to be appended to the {@linkplain #context() current} debug | |
218 * context | |
219 * @param context2 second object to be appended to the {@linkplain #context() current} debug | |
220 * context | |
221 * @param context3 third object to be appended to the {@linkplain #context() current} debug | |
222 * context | |
223 */ | |
224 public static Scope scope(Object name, Object context1, Object context2, Object context3) { | |
225 if (ENABLED) { | |
226 return DebugScope.getInstance().scope(convertFormatArg(name).toString(), null, context1, context2, context3); | |
184 } else { | 227 } else { |
185 return null; | 228 return null; |
186 } | 229 } |
187 } | 230 } |
188 | 231 |
230 } | 273 } |
231 | 274 |
232 /** | 275 /** |
233 * Handles an exception in the context of the debug scope just exited. The just exited scope | 276 * Handles an exception in the context of the debug scope just exited. The just exited scope |
234 * must have the current scope as its parent which will be the case if the try-with-resource | 277 * must have the current scope as its parent which will be the case if the try-with-resource |
235 * pattern recommended by {@link #scope(String, Object...)} and | 278 * pattern recommended by {@link #scope(Object)} and |
236 * {@link #sandbox(String, DebugConfig, Object...)} is used | 279 * {@link #sandbox(String, DebugConfig, Object...)} is used |
237 * | 280 * |
238 * @see #scope(String, Object...) | 281 * @see #scope(Object) |
239 * @see #sandbox(String, DebugConfig, Object...) | 282 * @see #sandbox(String, DebugConfig, Object...) |
240 */ | 283 */ |
241 public static RuntimeException handle(Throwable exception) { | 284 public static RuntimeException handle(Throwable exception) { |
242 if (ENABLED) { | 285 if (ENABLED) { |
243 return DebugScope.getInstance().handle(exception); | 286 return DebugScope.getInstance().handle(exception); |