< prev index next >

src/java.base/share/classes/java/lang/annotation/AnnotationTypeMismatchException.java

Print this page




  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package java.lang.annotation;
  27 import java.lang.reflect.Method;
  28 
  29 /**
  30  * Thrown to indicate that a program has attempted to access an element of
  31  * an annotation whose type has changed after the annotation was compiled
  32  * (or serialized).
  33  * This exception can be thrown by the {@linkplain
  34  * java.lang.reflect.AnnotatedElement API used to read annotations
  35  * reflectively}.
  36  *
  37  * @author  Josh Bloch
  38  * @see     java.lang.reflect.AnnotatedElement
  39  * @since 1.5
  40  */
  41 public class AnnotationTypeMismatchException extends RuntimeException {

  42     private static final long serialVersionUID = 8125925355765570191L;
  43 
  44     /**
  45      * The {@code Method} object for the annotation element.
  46      */
  47     private final transient Method element;
  48 
  49     /**
  50      * The (erroneous) type of data found in the annotation.  This string
  51      * may, but is not required to, contain the value as well.  The exact
  52      * format of the string is unspecified.
  53      */
  54     private final String foundType;
  55 
  56     /**
  57      * Constructs an AnnotationTypeMismatchException for the specified
  58      * annotation type element and found data type.
  59      *
  60      * @param element the {@code Method} object for the annotation
  61      * element, may be {@code null}




  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package java.lang.annotation;
  27 import java.lang.reflect.Method;
  28 
  29 /**
  30  * Thrown to indicate that a program has attempted to access an element of
  31  * an annotation whose type has changed after the annotation was compiled
  32  * (or serialized).
  33  * This exception can be thrown by the {@linkplain
  34  * java.lang.reflect.AnnotatedElement API used to read annotations
  35  * reflectively}.
  36  *
  37  * @author  Josh Bloch
  38  * @see     java.lang.reflect.AnnotatedElement
  39  * @since 1.5
  40  */
  41 public class AnnotationTypeMismatchException extends RuntimeException {
  42     @java.io.Serial
  43     private static final long serialVersionUID = 8125925355765570191L;
  44 
  45     /**
  46      * The {@code Method} object for the annotation element.
  47      */
  48     private final transient Method element;
  49 
  50     /**
  51      * The (erroneous) type of data found in the annotation.  This string
  52      * may, but is not required to, contain the value as well.  The exact
  53      * format of the string is unspecified.
  54      */
  55     private final String foundType;
  56 
  57     /**
  58      * Constructs an AnnotationTypeMismatchException for the specified
  59      * annotation type element and found data type.
  60      *
  61      * @param element the {@code Method} object for the annotation
  62      * element, may be {@code null}


< prev index next >