Dead
[official-gcc.git] / gomp-20050608-branch / libjava / classpath / java / lang / annotation / AnnotationTypeMismatchException.java
blob653305d632a552a630235ec46c5c667a3204b2ea
1 /* AnnotationTypeMismatchException.java - Thrown when annotation has changed
2 Copyright (C) 2004, 2005 Free Software Foundation
4 This file is part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 02110-1301 USA.
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
24 combination.
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
38 package java.lang.annotation;
40 import java.lang.reflect.Method;
42 /**
43 * Thrown when accessing an element within an annotation for
44 * which the type has changed, since compilation or serialization
45 * took place. The mismatch between the compiled or serialized
46 * type and the current type causes this exception to be thrown.
48 * @author Tom Tromey (tromey@redhat.com)
49 * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
50 * @since 1.5
52 public class AnnotationTypeMismatchException extends RuntimeException
55 /**
56 * For compatability with Sun's JDK
58 private static final long serialVersionUID = 8125925355765570191L;
60 /**
61 * Constructs an <code>AnnotationTypeMismatchException</code>
62 * which is due to a mismatched type in the annotation
63 * element, <code>m</code>. The erroneous type used for the
64 * data in <code>m</code> is represented by the string,
65 * <code>type</code>. This string is of an undefined format,
66 * and may contain the value as well as the type.
68 * @param m the element from the annotation.
69 * @param type the name of the erroneous type found in <code>m</code>.
71 public AnnotationTypeMismatchException(Method m, String type)
73 this.element = m;
74 this.foundType = type;
77 /**
78 * Returns the element from the annotation, for which a
79 * mismatch occurred.
81 * @return the element with the mismatched type.
83 public Method element()
85 return element;
88 /**
89 * Returns the erroneous type used by the element,
90 * represented as a <code>String</code>. The format
91 * of this <code>String</code> is not explicitly specified,
92 * and may contain the value as well as the type.
94 * @return the type found in the element.
96 public String foundType()
98 return foundType;
101 // Names are chosen from serialization spec.
103 * The element from the annotation.
105 * @serial the element with the mismatched type.
107 private Method element;
110 * The erroneous type used by the element.
112 * @serial the type found in the element.
114 private String foundType;