1 /* 2 * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. 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 java.lang.annotation; 27 28 /** 29 * Thrown when the annotation parser attempts to read an annotation 30 * from a class file and determines that the annotation is malformed. 31 * This error can be thrown by the {@linkplain 32 * java.lang.reflect.AnnotatedElement API used to read annotations 33 * reflectively}. 34 * 35 * @author Josh Bloch 36 * @see java.lang.reflect.AnnotatedElement 37 * @since 1.5 38 */ 39 public class AnnotationFormatError extends Error { 40 @java.io.Serial 41 private static final long serialVersionUID = -4256701562333669892L; 42 43 /** 44 * Constructs a new {@code AnnotationFormatError} with the specified 45 * detail message. 46 * 47 * @param message the detail message. 48 */ AnnotationFormatError(String message)49 public AnnotationFormatError(String message) { 50 super(message); 51 } 52 53 /** 54 * Constructs a new {@code AnnotationFormatError} with the specified 55 * detail message and cause. Note that the detail message associated 56 * with {@code cause} is <i>not</i> automatically incorporated in 57 * this error's detail message. 58 * 59 * @param message the detail message 60 * @param cause the cause (A {@code null} value is permitted, and 61 * indicates that the cause is nonexistent or unknown.) 62 */ AnnotationFormatError(String message, Throwable cause)63 public AnnotationFormatError(String message, Throwable cause) { 64 super(message, cause); 65 } 66 67 68 /** 69 * Constructs a new {@code AnnotationFormatError} with the specified 70 * cause and a detail message of 71 * {@code (cause == null ? null : cause.toString())} (which 72 * typically contains the class and detail message of {@code cause}). 73 * 74 * @param cause the cause (A {@code null} value is permitted, and 75 * indicates that the cause is nonexistent or unknown.) 76 */ AnnotationFormatError(Throwable cause)77 public AnnotationFormatError(Throwable cause) { 78 super(cause); 79 } 80 } 81