57 */ |
57 */ |
58 Element asElement(TypeMirror t); |
58 Element asElement(TypeMirror t); |
59 |
59 |
60 /** |
60 /** |
61 * Tests whether two {@code TypeMirror} objects represent the same type. |
61 * Tests whether two {@code TypeMirror} objects represent the same type. |
62 * |
|
63 * <p>Since annotations are only meta-data associated with a type, |
|
64 * the set of annotations on either argument is <em>not</em> taken |
|
65 * into account when computing whether or not two {@code |
|
66 * TypeMirror} objects are the same type. In particular, two |
|
67 * {@code TypeMirror} objects can have different annotations and |
|
68 * still be considered the same. |
|
69 * |
62 * |
70 * <p>Caveat: if either of the arguments to this method represents a |
63 * <p>Caveat: if either of the arguments to this method represents a |
71 * wildcard, this method will return false. As a consequence, a wildcard |
64 * wildcard, this method will return false. As a consequence, a wildcard |
72 * is not the same type as itself. This might be surprising at first, |
65 * is not the same type as itself. This might be surprising at first, |
73 * but makes sense once you consider that an example like this must be |
66 * but makes sense once you consider that an example like this must be |
75 * <pre> |
68 * <pre> |
76 * {@code List<?> list = new ArrayList<Object>();} |
69 * {@code List<?> list = new ArrayList<Object>();} |
77 * {@code list.add(list.get(0));} |
70 * {@code list.add(list.get(0));} |
78 * </pre> |
71 * </pre> |
79 * |
72 * |
|
73 * <p>Since annotations are only meta-data associated with a type, |
|
74 * the set of annotations on either argument is <em>not</em> taken |
|
75 * into account when computing whether or not two {@code |
|
76 * TypeMirror} objects are the same type. In particular, two |
|
77 * {@code TypeMirror} objects can have different annotations and |
|
78 * still be considered the same. |
|
79 * |
80 * @param t1 the first type |
80 * @param t1 the first type |
81 * @param t2 the second type |
81 * @param t2 the second type |
82 * @return {@code true} if and only if the two types are the same |
82 * @return {@code true} if and only if the two types are the same |
83 */ |
83 */ |
84 boolean isSameType(TypeMirror t1, TypeMirror t2); |
84 boolean isSameType(TypeMirror t1, TypeMirror t2); |