Path: blob/master/src/java.compiler/share/classes/javax/lang/model/element/UnknownAnnotationValueException.java
41161 views
/*1* Copyright (c) 2005, 2019, 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 annotation value was encountered.31* This can occur if the language evolves and new kinds of annotation32* values can be stored in an annotation. May be thrown by an33* {@linkplain AnnotationValueVisitor annotation value visitor} to34* indicate that the visitor was created for a prior version of the35* language.36*37* @author Joseph D. Darcy38* @author Scott Seligman39* @author Peter von der Ahé40* @see AnnotationValueVisitor#visitUnknown41* @since 1.642*/43public class UnknownAnnotationValueException extends UnknownEntityException {4445private static final long serialVersionUID = 269L;4647private transient AnnotationValue av;48private transient Object parameter;4950/**51* Creates a new {@code UnknownAnnotationValueException}. The52* {@code p} parameter may be used to pass in an additional53* argument with information about the context in which the54* unknown annotation value was encountered; for example, the55* visit methods of {@link AnnotationValueVisitor} may pass in56* their additional parameter.57*58* @param av the unknown annotation value, may be {@code null}59* @param p an additional parameter, may be {@code null}60*/61public UnknownAnnotationValueException(AnnotationValue av, Object p) {62super("Unknown annotation value: \"" + av + "\"");63this.av = av;64this.parameter = p;65}6667/**68* Returns the unknown annotation value.69* The value may be unavailable if this exception has been70* serialized and then read back in.71*72* @return the unknown element, or {@code null} if unavailable73*/74public AnnotationValue getUnknownAnnotationValue() {75return av;76}7778/**79* Returns the additional argument.80*81* @return the additional argument, or {@code null} if unavailable82*/83public Object getArgument() {84return parameter;85}86}878889