81 |
81 |
82 /** An accessor method for the attributes of this symbol. |
82 /** An accessor method for the attributes of this symbol. |
83 * Attributes of class symbols should be accessed through the accessor |
83 * Attributes of class symbols should be accessed through the accessor |
84 * method to make sure that the class symbol is loaded. |
84 * method to make sure that the class symbol is loaded. |
85 */ |
85 */ |
86 public List<Attribute.Compound> getAnnotationMirrors() { |
86 public List<Attribute.Compound> getRawAttributes() { |
87 return Assert.checkNonNull(annotations.getAttributes()); |
87 return annotations.getAttributes(); |
88 } |
88 } |
89 |
89 |
90 /** Fetch a particular annotation from a symbol. */ |
90 /** Fetch a particular annotation from a symbol. */ |
91 public Attribute.Compound attribute(Symbol anno) { |
91 public Attribute.Compound attribute(Symbol anno) { |
92 for (Attribute.Compound a : getAnnotationMirrors()) { |
92 for (Attribute.Compound a : getRawAttributes()) { |
93 if (a.type.tsym == anno) return a; |
93 if (a.type.tsym == anno) return a; |
94 } |
94 } |
95 return null; |
95 return null; |
96 } |
96 } |
97 |
97 |
445 public Name getSimpleName() { |
445 public Name getSimpleName() { |
446 return name; |
446 return name; |
447 } |
447 } |
448 |
448 |
449 /** |
449 /** |
|
450 * This is the implementation for {@code |
|
451 * javax.lang.model.element.Element.getAnnotationMirrors()}. |
|
452 */ |
|
453 public final List<Attribute.Compound> getAnnotationMirrors() { |
|
454 return getRawAttributes(); |
|
455 } |
|
456 |
|
457 /** |
450 * @deprecated this method should never be used by javac internally. |
458 * @deprecated this method should never be used by javac internally. |
451 */ |
459 */ |
452 @Deprecated |
460 @Deprecated |
453 public <A extends java.lang.annotation.Annotation> A getAnnotation(Class<A> annoType) { |
461 public <A extends java.lang.annotation.Annotation> A getAnnotation(Class<A> annoType) { |
454 return JavacElements.getAnnotation(this, annoType); |
462 return JavacElements.getAnnotation(this, annoType); |
660 public long flags() { |
668 public long flags() { |
661 if (completer != null) complete(); |
669 if (completer != null) complete(); |
662 return flags_field; |
670 return flags_field; |
663 } |
671 } |
664 |
672 |
665 public List<Attribute.Compound> getAnnotationMirrors() { |
673 @Override |
|
674 public List<Attribute.Compound> getRawAttributes() { |
666 if (completer != null) complete(); |
675 if (completer != null) complete(); |
667 if (package_info != null && package_info.completer != null) { |
676 if (package_info != null && package_info.completer != null) { |
668 package_info.complete(); |
677 package_info.complete(); |
669 if (annotations.isEmpty()) { |
678 mergeAttributes(); |
670 annotations.setAttributes(package_info.annotations); |
679 } |
671 } |
680 return super.getRawAttributes(); |
672 } |
681 } |
673 return Assert.checkNonNull(annotations.getAttributes()); |
682 |
|
683 private void mergeAttributes() { |
|
684 if (annotations.isEmpty() && |
|
685 !package_info.annotations.isEmpty()) { |
|
686 annotations.setAttributes(package_info.annotations); |
|
687 } |
674 } |
688 } |
675 |
689 |
676 /** A package "exists" if a type or package that exists has |
690 /** A package "exists" if a type or package that exists has |
677 * been seen within it. |
691 * been seen within it. |
678 */ |
692 */ |
768 public Scope members() { |
782 public Scope members() { |
769 if (completer != null) complete(); |
783 if (completer != null) complete(); |
770 return members_field; |
784 return members_field; |
771 } |
785 } |
772 |
786 |
773 public List<Attribute.Compound> getAnnotationMirrors() { |
787 @Override |
|
788 public List<Attribute.Compound> getRawAttributes() { |
774 if (completer != null) complete(); |
789 if (completer != null) complete(); |
775 return Assert.checkNonNull(annotations.getAttributes()); |
790 return super.getRawAttributes(); |
776 } |
791 } |
777 |
792 |
778 public Type erasure(Types types) { |
793 public Type erasure(Types types) { |
779 if (erasure_field == null) |
794 if (erasure_field == null) |
780 erasure_field = new ClassType(types.erasure(type.getEnclosingType()), |
795 erasure_field = new ClassType(types.erasure(type.getEnclosingType()), |