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

changeset 1709
bae8387d16aa
parent 1692
b26f36a7ae3b
child 1802
8fb68f73d4b1
equal deleted inserted replaced
1708:d59730bd3162 1709:bae8387d16aa
463 463
464 /** 464 /**
465 * This is the implementation for {@code 465 * This is the implementation for {@code
466 * javax.lang.model.element.Element.getAnnotationMirrors()}. 466 * javax.lang.model.element.Element.getAnnotationMirrors()}.
467 */ 467 */
468 public final List<? extends AnnotationMirror> getAnnotationMirrors() { 468 @Override
469 public List<Attribute.Compound> getAnnotationMirrors() {
469 return getRawAttributes(); 470 return getRawAttributes();
470 }
471
472 /**
473 * TODO: Should there be a {@code
474 * javax.lang.model.element.Element.getTypeAnnotationMirrors()}.
475 */
476 public final List<Attribute.TypeCompound> getTypeAnnotationMirrors() {
477 return getRawTypeAttributes();
478 } 471 }
479 472
480 /** 473 /**
481 * @deprecated this method should never be used by javac internally. 474 * @deprecated this method should never be used by javac internally.
482 */ 475 */
652 } else { 645 } else {
653 // No superclass was given in bounds. 646 // No superclass was given in bounds.
654 // In this case, supertype is Object, erasure is first interface. 647 // In this case, supertype is Object, erasure is first interface.
655 return ct.interfaces_field; 648 return ct.interfaces_field;
656 } 649 }
650 }
651
652 @Override
653 public List<Attribute.Compound> getAnnotationMirrors() {
654 return onlyTypeVariableAnnotations(owner.getRawTypeAttributes());
655 }
656
657 private List<Attribute.Compound> onlyTypeVariableAnnotations(
658 List<Attribute.TypeCompound> candidates) {
659 // Declaration annotations on TypeParameters are stored in type attributes
660 List<Attribute.Compound> res = List.nil();
661 for (Attribute.TypeCompound a : candidates) {
662 if (a.position.type == TargetType.CLASS_TYPE_PARAMETER ||
663 a.position.type == TargetType.METHOD_TYPE_PARAMETER)
664 res = res.prepend(a);
665 }
666
667 return res = res.reverse();
657 } 668 }
658 669
659 @Override 670 @Override
660 public <R, P> R accept(ElementVisitor<R, P> v, P p) { 671 public <R, P> R accept(ElementVisitor<R, P> v, P p) {
661 return v.visitTypeParameter(this, p); 672 return v.visitTypeParameter(this, p);

mercurial