32 import java.io.ObjectInputStream;
33 import java.io.IOException;
34 import javax.lang.model.element.Element;
35
36
37 /**
38 * Thrown when an application attempts to access a sequence of {@link
39 * Class} objects each corresponding to a {@link TypeMirror}.
40 *
41 * @author Joseph D. Darcy
42 * @author Scott Seligman
43 * @author Peter von der Ahé
44 * @see MirroredTypeException
45 * @see Element#getAnnotation(Class)
46 * @since 1.6
47 */
48 public class MirroredTypesException extends RuntimeException {
49
50 private static final long serialVersionUID = 269;
51
52 private transient List<? extends TypeMirror> types; // cannot be serialized
53
54 /**
55 * Constructs a new MirroredTypesException for the specified types.
56 *
57 * @param types the types being accessed
58 */
59 public MirroredTypesException(List<? extends TypeMirror> types) {
60 super("Attempt to access Class objects for TypeMirrors " +
61 (types = // defensive copy
62 new ArrayList<TypeMirror>(types)).toString() );
63 this.types = Collections.unmodifiableList(types);
64 }
65
66 /**
67 * Returns the type mirrors corresponding to the types being accessed.
68 * The type mirrors may be unavailable if this exception has been
69 * serialized and then read back in.
70 *
71 * @return the type mirrors in construction order, or {@code null} if unavailable
72 */
|
32 import java.io.ObjectInputStream;
33 import java.io.IOException;
34 import javax.lang.model.element.Element;
35
36
37 /**
38 * Thrown when an application attempts to access a sequence of {@link
39 * Class} objects each corresponding to a {@link TypeMirror}.
40 *
41 * @author Joseph D. Darcy
42 * @author Scott Seligman
43 * @author Peter von der Ahé
44 * @see MirroredTypeException
45 * @see Element#getAnnotation(Class)
46 * @since 1.6
47 */
48 public class MirroredTypesException extends RuntimeException {
49
50 private static final long serialVersionUID = 269;
51
52 transient List<? extends TypeMirror> types; // cannot be serialized
53
54 /*
55 * Trusted constructor to be called by MirroredTypeException.
56 */
57 MirroredTypesException(String message, TypeMirror type) {
58 super(message);
59 List<TypeMirror> tmp = (new ArrayList<TypeMirror>());
60 tmp.add(type);
61 types = Collections.unmodifiableList(tmp);
62 }
63
64 /**
65 * Constructs a new MirroredTypesException for the specified types.
66 *
67 * @param types the types being accessed
68 */
69 public MirroredTypesException(List<? extends TypeMirror> types) {
70 super("Attempt to access Class objects for TypeMirrors " +
71 (types = // defensive copy
72 new ArrayList<TypeMirror>(types)).toString() );
73 this.types = Collections.unmodifiableList(types);
74 }
75
76 /**
77 * Returns the type mirrors corresponding to the types being accessed.
78 * The type mirrors may be unavailable if this exception has been
79 * serialized and then read back in.
80 *
81 * @return the type mirrors in construction order, or {@code null} if unavailable
82 */
|