Path: blob/master/src/java.compiler/share/classes/javax/lang/model/element/UnknownDirectiveException.java
41161 views
/*1* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package javax.lang.model.element;2627import javax.lang.model.UnknownEntityException;2829/**30* Indicates that an unknown kind of module directive was encountered.31* This can occur if the language evolves and new kinds of directives are32* added to the {@code Directive} hierarchy. May be thrown by a33* {@linkplain ModuleElement.DirectiveVisitor directive visitor} to34* indicate that the visitor was created for a prior version of the language.35*36* @author Joseph D. Darcy37* @author Scott Seligman38* @author Peter von der Ahé39* @see ModuleElement.DirectiveVisitor#visitUnknown40* @since 941*/42public class UnknownDirectiveException extends UnknownEntityException {4344private static final long serialVersionUID = 269L;4546private final transient ModuleElement.Directive directive;47private final transient Object parameter;4849/**50* Creates a new {@code UnknownElementException}. The {@code p}51* parameter may be used to pass in an additional argument with52* information about the context in which the unknown directive was53* encountered; for example, the visit methods of {@link54* ModuleElement.DirectiveVisitor DirectiveVisitor} may pass in55* their additional parameter.56*57* @param d the unknown directive, may be {@code null}58* @param p an additional parameter, may be {@code null}59*/60public UnknownDirectiveException(ModuleElement.Directive d, Object p) {61super("Unknown directive: " + d);62directive = d;63parameter = p;64}6566/**67* Returns the unknown directive.68* The value may be unavailable if this exception has been69* serialized and then read back in.70*71* @return the unknown directive, or {@code null} if unavailable72*/73public ModuleElement.Directive getUnknownDirective() {74return directive;75}7677/**78* Returns the additional argument.79*80* @return the additional argument, or {@code null} if unavailable81*/82public Object getArgument() {83return parameter;84}85}868788