40 |
import java.lang.reflect.Method; |
import java.lang.reflect.Method; |
41 |
|
|
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. |
47 |
|
* |
48 |
* @author Tom Tromey (tromey@redhat.com) |
* @author Tom Tromey (tromey@redhat.com) |
49 |
* @author Andrew John Hughes (gnu_andrew@member.fsf.org) |
* @author Andrew John Hughes (gnu_andrew@member.fsf.org) |
50 |
* @since 1.5 |
* @since 1.5 |
51 |
*/ |
*/ |
52 |
public class AnnotationTypeMismatchException extends RuntimeException |
public class AnnotationTypeMismatchException extends RuntimeException |
53 |
{ |
{ |
54 |
|
|
55 |
|
/** |
56 |
|
* Constructs an <code>AnnotationTypeMismatchException</code> |
57 |
|
* which is due to a mismatched type in the annotation |
58 |
|
* element, <code>m</code>. The erroneous type used for the |
59 |
|
* data in <code>m</code> is represented by the string, |
60 |
|
* <code>type</code>. This string is of an undefined format, |
61 |
|
* and may contain the value as well as the type. |
62 |
|
* |
63 |
|
* @param m the element from the annotation. |
64 |
|
* @param type the name of the erroneous type found in <code>m</code>. |
65 |
|
*/ |
66 |
public AnnotationTypeMismatchException(Method m, String type) |
public AnnotationTypeMismatchException(Method m, String type) |
67 |
{ |
{ |
68 |
this.element = m; |
this.element = m; |
69 |
this.foundType = type; |
this.foundType = type; |
70 |
} |
} |
71 |
|
|
72 |
|
/** |
73 |
|
* Returns the element from the annotation, for which a |
74 |
|
* mismatch occurred. |
75 |
|
* |
76 |
|
* @return the element with the mismatched type. |
77 |
|
*/ |
78 |
public Method element() |
public Method element() |
79 |
{ |
{ |
80 |
return element; |
return element; |
81 |
} |
} |
82 |
|
|
83 |
|
/** |
84 |
|
* Returns the erroneous type used by the element, |
85 |
|
* represented as a <code>String</code>. The format |
86 |
|
* of this <code>String</code> is not explicitly specified, |
87 |
|
* and may contain the value as well as the type. |
88 |
|
* |
89 |
|
* @return the type found in the element. |
90 |
|
*/ |
91 |
public String foundType() |
public String foundType() |
92 |
{ |
{ |
93 |
return foundType; |
return foundType; |
94 |
} |
} |
95 |
|
|
96 |
// Names are chosen from serialization spec. |
// Names are chosen from serialization spec. |
97 |
|
/** |
98 |
|
* The element from the annotation. |
99 |
|
* |
100 |
|
* @serial the element with the mismatched type. |
101 |
|
*/ |
102 |
private Method element; |
private Method element; |
103 |
|
|
104 |
|
/** |
105 |
|
* The erroneous type used by the element. |
106 |
|
* |
107 |
|
* @serial the type found in the element. |
108 |
|
*/ |
109 |
private String foundType; |
private String foundType; |
110 |
|
|
111 |
} |
} |