author | pliden |
Fri, 23 Aug 2019 08:48:27 +0200 | |
changeset 57852 | 92f994585e25 |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
10 | 1 |
/* |
43567
d0d89c3da7be
8173676: Improvements to javax.annotation.processing and javax.lang.model doc
darcy
parents:
25874
diff
changeset
|
2 |
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. |
10 | 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 |
|
5520 | 7 |
* published by the Free Software Foundation. Oracle designates this |
10 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5520 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
10 | 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 |
* |
|
5520 | 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. |
|
10 | 24 |
*/ |
25 |
||
26 |
package javax.lang.model.element; |
|
27 |
||
1997
df0f51fe10de
6794071: Provide exception superclass for UnknownFooExceptions
darcy
parents:
10
diff
changeset
|
28 |
import javax.lang.model.UnknownEntityException; |
df0f51fe10de
6794071: Provide exception superclass for UnknownFooExceptions
darcy
parents:
10
diff
changeset
|
29 |
|
10 | 30 |
/** |
44062 | 31 |
* Indicates that an unknown kind of module directive was encountered. |
32 |
* This can occur if the language evolves and new kinds of directives are |
|
33 |
* added to the {@code Directive} hierarchy. May be thrown by a |
|
34 |
* {@linkplain ModuleElement.DirectiveVisitor directive visitor} to |
|
35 |
* indicate that the visitor was created for a prior version of the language. |
|
10 | 36 |
* |
37 |
* @author Joseph D. Darcy |
|
38 |
* @author Scott Seligman |
|
39 |
* @author Peter von der Ahé |
|
44062 | 40 |
* @see ModuleElement.DirectiveVisitor#visitUnknown |
41 |
* @since 9 |
|
42 |
* @spec JPMS |
|
10 | 43 |
*/ |
44062 | 44 |
public class UnknownDirectiveException extends UnknownEntityException { |
10 | 45 |
|
46 |
private static final long serialVersionUID = 269L; |
|
47 |
||
44062 | 48 |
private final transient ModuleElement.Directive directive; |
49 |
private final transient Object parameter; |
|
10 | 50 |
|
51 |
/** |
|
52 |
* Creates a new {@code UnknownElementException}. The {@code p} |
|
53 |
* parameter may be used to pass in an additional argument with |
|
44062 | 54 |
* information about the context in which the unknown directive was |
10 | 55 |
* encountered; for example, the visit methods of {@link |
44062 | 56 |
* ModuleElement.DirectiveVisitor DirectiveVisitor} may pass in |
57 |
* their additional parameter. |
|
10 | 58 |
* |
44062 | 59 |
* @param d the unknown directive, may be {@code null} |
10 | 60 |
* @param p an additional parameter, may be {@code null} |
61 |
*/ |
|
44062 | 62 |
public UnknownDirectiveException(ModuleElement.Directive d, Object p) { |
63 |
super("Unknown directive: " + d); |
|
64 |
directive = d; |
|
65 |
parameter = p; |
|
10 | 66 |
} |
67 |
||
68 |
/** |
|
44062 | 69 |
* Returns the unknown directive. |
10 | 70 |
* The value may be unavailable if this exception has been |
71 |
* serialized and then read back in. |
|
72 |
* |
|
44062 | 73 |
* @return the unknown directive, or {@code null} if unavailable |
10 | 74 |
*/ |
44062 | 75 |
public ModuleElement.Directive getUnknownDirective() { |
76 |
return directive; |
|
10 | 77 |
} |
78 |
||
79 |
/** |
|
80 |
* Returns the additional argument. |
|
81 |
* |
|
43567
d0d89c3da7be
8173676: Improvements to javax.annotation.processing and javax.lang.model doc
darcy
parents:
25874
diff
changeset
|
82 |
* @return the additional argument, or {@code null} if unavailable |
10 | 83 |
*/ |
84 |
public Object getArgument() { |
|
85 |
return parameter; |
|
86 |
} |
|
87 |
} |