author | prr |
Mon, 12 Feb 2018 08:56:44 -0800 | |
changeset 49083 | 673be6f60323 |
parent 47216 | 71c04702a3d5 |
child 49515 | 083318155ad1 |
permissions | -rw-r--r-- |
33362 | 1 |
/* |
36499 | 2 |
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. |
33362 | 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. Oracle designates this |
|
8 |
* particular file as subject to the "Classpath" exception as provided |
|
9 |
* by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
24 |
*/ |
|
25 |
||
26 |
package jdk.jshell; |
|
27 |
||
28 |
/** |
|
29 |
* Exception reported on attempting to execute a |
|
30 |
* {@link jdk.jshell.Snippet.Status#RECOVERABLE_DEFINED RECOVERABLE_DEFINED} |
|
36499 | 31 |
* snippet. |
33362 | 32 |
* <p> |
33 |
* The stack can be queried by methods on <code>Exception</code>. |
|
34 |
* Note that in stack trace frames representing JShell Snippets, |
|
35 |
* <code>StackTraceElement.getFileName()</code> will return "#" followed by |
|
36 |
* the Snippet id and for snippets without a method name (for example an |
|
36499 | 37 |
* expression) <code>StackTraceElement.getName()</code> will be the |
33362 | 38 |
* empty string. |
43770 | 39 |
* |
40 |
* @since 9 |
|
33362 | 41 |
*/ |
42 |
@SuppressWarnings("serial") // serialVersionUID intentionally omitted |
|
37751
77e7bb904a13
8139837: JShell API: make a common JShellException
rfield
parents:
36499
diff
changeset
|
43 |
public class UnresolvedReferenceException extends JShellException { |
33362 | 44 |
|
36499 | 45 |
final DeclarationSnippet snippet; |
33362 | 46 |
|
36499 | 47 |
UnresolvedReferenceException(DeclarationSnippet snippet, StackTraceElement[] stackElements) { |
48 |
super("Attempt to use definition snippet with unresolved references"); |
|
49 |
this.snippet = snippet; |
|
33362 | 50 |
this.setStackTrace(stackElements); |
51 |
} |
|
52 |
||
53 |
/** |
|
36499 | 54 |
* Return the Snippet which has the unresolved reference(s). |
55 |
* @return the <code>Snippet</code> of the |
|
33362 | 56 |
* {@link jdk.jshell.Snippet.Status#RECOVERABLE_DEFINED RECOVERABLE_DEFINED} |
36499 | 57 |
* definition snippet. |
33362 | 58 |
*/ |
36499 | 59 |
public DeclarationSnippet getSnippet() { |
60 |
return snippet; |
|
33362 | 61 |
} |
62 |
} |