src/share/classes/com/sun/tools/javac/code/Type.java

changeset 1645
97f6839673d6
parent 1644
40adaf938847
child 1678
c635a966ce84
equal deleted inserted replaced
1644:40adaf938847 1645:97f6839673d6
23 * questions. 23 * questions.
24 */ 24 */
25 25
26 package com.sun.tools.javac.code; 26 package com.sun.tools.javac.code;
27 27
28 import com.sun.tools.javac.model.JavacAnnoConstructs;
29 import com.sun.tools.javac.model.JavacTypes;
30 import java.lang.annotation.Annotation;
28 import java.util.Collections; 31 import java.util.Collections;
29 import java.util.EnumMap; 32 import java.util.EnumMap;
30 import java.util.EnumSet; 33 import java.util.EnumSet;
31 import java.util.Map; 34 import java.util.Map;
32 import java.util.Set; 35 import java.util.Set;
256 */ 259 */
257 public Type unannotatedType() { 260 public Type unannotatedType() {
258 return this; 261 return this;
259 } 262 }
260 263
264 @Override
265 public List<? extends Attribute.TypeCompound> getAnnotationMirrors() {
266 return List.nil();
267 }
268
269 @Override
270 public <A extends Annotation> A getAnnotation(Class<A> annotationType) {
271 return null;
272 }
273
274 @Override
275 public <A extends Annotation> A[] getAnnotationsByType(Class<A> annotationType) {
276 @SuppressWarnings("unchecked")
277 A[] tmp = (A[]) java.lang.reflect.Array.newInstance(annotationType, 0);
278 return tmp;
279 }
280
261 /** Return the base types of a list of types. 281 /** Return the base types of a list of types.
262 */ 282 */
263 public static List<Type> baseTypes(List<Type> ts) { 283 public static List<Type> baseTypes(List<Type> ts) {
264 if (ts.nonEmpty()) { 284 if (ts.nonEmpty()) {
265 Type t = ts.head.baseType(); 285 Type t = ts.head.baseType();
352 args = args.tail; 372 args = args.tail;
353 buf.append(','); 373 buf.append(',');
354 } 374 }
355 if (args.head.unannotatedType().tag == ARRAY) { 375 if (args.head.unannotatedType().tag == ARRAY) {
356 buf.append(((ArrayType)args.head.unannotatedType()).elemtype); 376 buf.append(((ArrayType)args.head.unannotatedType()).elemtype);
357 if (args.head.getAnnotations().nonEmpty()) { 377 if (args.head.getAnnotationMirrors().nonEmpty()) {
358 buf.append(args.head.getAnnotations()); 378 buf.append(args.head.getAnnotationMirrors());
359 } 379 }
360 buf.append("..."); 380 buf.append("...");
361 } else { 381 } else {
362 buf.append(args.head); 382 buf.append(args.head);
363 } 383 }
364 return buf.toString(); 384 return buf.toString();
365 } 385 }
366 386
367 /** Access methods. 387 /** Access methods.
368 */ 388 */
369 public List<? extends AnnotationMirror> getAnnotations() { return List.nil(); }
370 public List<Type> getTypeArguments() { return List.nil(); } 389 public List<Type> getTypeArguments() { return List.nil(); }
371 public Type getEnclosingType() { return null; } 390 public Type getEnclosingType() { return null; }
372 public List<Type> getParameterTypes() { return List.nil(); } 391 public List<Type> getParameterTypes() { return List.nil(); }
373 public Type getReturnType() { return null; } 392 public Type getReturnType() { return null; }
374 public Type getReceiverType() { return null; } 393 public Type getReceiverType() { return null; }
1579 public boolean isAnnotated() { 1598 public boolean isAnnotated() {
1580 return true; 1599 return true;
1581 } 1600 }
1582 1601
1583 @Override 1602 @Override
1603 public List<? extends Attribute.TypeCompound> getAnnotationMirrors() {
1604 return typeAnnotations;
1605 }
1606
1607 @Override
1608 public <A extends Annotation> A getAnnotation(Class<A> annotationType) {
1609 return JavacAnnoConstructs.getAnnotation(this, annotationType);
1610 }
1611
1612 @Override
1613 public <A extends Annotation> A[] getAnnotationsByType(Class<A> annotationType) {
1614 return JavacAnnoConstructs.getAnnotationsByType(this, annotationType);
1615 }
1616
1617 @Override
1584 public TypeKind getKind() { 1618 public TypeKind getKind() {
1585 return underlyingType.getKind(); 1619 return underlyingType.getKind();
1586 }
1587
1588 @Override
1589 public List<? extends AnnotationMirror> getAnnotations() {
1590 return typeAnnotations;
1591 } 1620 }
1592 1621
1593 @Override 1622 @Override
1594 public Type unannotatedType() { 1623 public Type unannotatedType() {
1595 return underlyingType; 1624 return underlyingType;

mercurial