@@ -165,6 +165,7 @@ typedef VariableElement2 = VariableElement;
165165
166166/// An element or fragment that can have either annotations (metadata), a
167167/// documentation comment, or both associated with it.
168+ @Deprecated ('Use Element or Fragment directly instead' )
168169abstract class Annotatable {
169170 /// The content of the documentation comment (including delimiters) for this
170171 /// element or fragment.
@@ -600,6 +601,14 @@ abstract class Element {
600601 /// but the `displayName` is `s` .
601602 String get displayName;
602603
604+ /// The content of the documentation comment (including delimiters) for this
605+ /// element.
606+ ///
607+ /// This is a concatenation of the comments from all of the fragments.
608+ ///
609+ /// Returns `null` if the element doesn't have documentation.
610+ String ? get documentationComment;
611+
603612 /// The element that either physically or logically encloses this element.
604613 ///
605614 /// Returns `null` if this element is a library because libraries are the
@@ -676,6 +685,13 @@ abstract class Element {
676685 /// For a binary operator `-` the result is just `-` .
677686 String ? get lookupName;
678687
688+ /// The metadata associated with the element.
689+ ///
690+ /// It includes all annotations from all of the fragments.
691+ ///
692+ /// The list will be empty if the element does not have any metadata.
693+ Metadata get metadata;
694+
679695 /// The name of this element.
680696 ///
681697 /// Returns `null` if this element doesn't have a name.
@@ -1012,7 +1028,10 @@ abstract class ElementAnnotation {
10121028/// A directive within a library fragment.
10131029///
10141030/// Clients may not extend, implement or mix-in this class.
1015- abstract class ElementDirective implements Annotatable {
1031+ abstract class ElementDirective
1032+ implements
1033+ Annotatable // ignore:deprecated_member_use_from_same_package
1034+ {
10161035 /// The library fragment that contains this object.
10171036 LibraryFragment get libraryFragment;
10181037
@@ -1581,7 +1600,10 @@ abstract class FieldFragment implements PropertyInducingFragment {
15811600///
15821601/// Clients may not extend, implement or mix-in this class.
15831602abstract class FormalParameterElement
1584- implements VariableElement , Annotatable , LocalElement {
1603+ implements
1604+ VariableElement ,
1605+ Annotatable , // ignore:deprecated_member_use_from_same_package
1606+ LocalElement {
15851607 @override
15861608 FormalParameterElement get baseElement;
15871609
@@ -1692,7 +1714,10 @@ abstract class FormalParameterElement
16921714///
16931715/// Clients may not extend, implement, or mix-in this class.
16941716abstract class FormalParameterFragment
1695- implements VariableFragment , Annotatable , LocalFragment {
1717+ implements
1718+ VariableFragment ,
1719+ Annotatable , // ignore:deprecated_member_use_from_same_package
1720+ LocalFragment {
16961721 @override
16971722 FormalParameterElement get element;
16981723
@@ -1735,6 +1760,12 @@ abstract class Fragment {
17351760 @Deprecated ('Use children instead' )
17361761 List <Fragment > get children3;
17371762
1763+ /// The content of the documentation comment (including delimiters) for this
1764+ /// fragment.
1765+ ///
1766+ /// Returns `null` if the fragment doesn't have documentation.
1767+ String ? get documentationComment;
1768+
17381769 /// The element composed from this fragment and possibly other fragments.
17391770 Element get element;
17401771
@@ -1749,6 +1780,11 @@ abstract class Fragment {
17491780 /// This will be the fragment itself if it is a library fragment.
17501781 LibraryFragment ? get libraryFragment;
17511782
1783+ /// The metadata associated with the fragment.
1784+ ///
1785+ /// The list will be empty if the fragment does not have any metadata.
1786+ Metadata get metadata;
1787+
17521788 /// The name of the fragment.
17531789 ///
17541790 /// Never empty.
@@ -2564,7 +2600,11 @@ abstract class LabelFragment implements Fragment {
25642600/// A library.
25652601///
25662602/// Clients may not extend, implement or mix-in this class.
2567- abstract class LibraryElement implements Element , Annotatable {
2603+ abstract class LibraryElement
2604+ implements
2605+ Element ,
2606+ Annotatable // ignore:deprecated_member_use_from_same_package
2607+ {
25682608 /// The classes defined in this library.
25692609 ///
25702610 /// There is no guarantee of the order in which the classes will be returned.
@@ -3045,7 +3085,11 @@ abstract class LocalFunctionFragment
30453085///
30463086/// Clients may not extend, implement or mix-in this class.
30473087abstract class LocalVariableElement
3048- implements VariableElement , LocalElement , Annotatable {
3088+ implements
3089+ VariableElement ,
3090+ LocalElement ,
3091+ Annotatable // ignore:deprecated_member_use_from_same_package
3092+ {
30493093 @override
30503094 LocalVariableElement get baseElement;
30513095
@@ -3523,7 +3567,11 @@ abstract class PropertyAccessorFragment implements ExecutableFragment {
35233567/// [PropertyInducingElement] .
35243568///
35253569/// Clients may not extend, implement or mix-in this class.
3526- abstract class PropertyInducingElement implements VariableElement , Annotatable {
3570+ abstract class PropertyInducingElement
3571+ implements
3572+ VariableElement ,
3573+ Annotatable // ignore:deprecated_member_use_from_same_package
3574+ {
35273575 @override
35283576 PropertyInducingFragment get firstFragment;
35293577
@@ -3584,7 +3632,10 @@ abstract class PropertyInducingElement implements VariableElement, Annotatable {
35843632///
35853633/// Clients may not extend, implement or mix-in this class.
35863634abstract class PropertyInducingFragment
3587- implements VariableFragment , Annotatable {
3635+ implements
3636+ VariableFragment ,
3637+ Annotatable // ignore:deprecated_member_use_from_same_package
3638+ {
35883639 @override
35893640 PropertyInducingElement get element;
35903641
@@ -3868,7 +3919,11 @@ abstract class TypeAliasFragment
38683919/// An element that defines a type.
38693920///
38703921/// Clients may not extend, implement or mix-in this class.
3871- abstract class TypeDefiningElement implements Element , Annotatable {
3922+ abstract class TypeDefiningElement
3923+ implements
3924+ Element ,
3925+ Annotatable // ignore:deprecated_member_use_from_same_package
3926+ {
38723927 // TODO(brianwilkerson): Evaluate to see whether this type is actually needed
38733928 // after converting clients to the new API.
38743929
@@ -3882,7 +3937,11 @@ abstract class TypeDefiningElement implements Element, Annotatable {
38823937/// The portion of a [TypeDefiningElement] contributed by a single declaration.
38833938///
38843939/// Clients may not extend, implement or mix-in this class.
3885- abstract class TypeDefiningFragment implements Fragment , Annotatable {
3940+ abstract class TypeDefiningFragment
3941+ implements
3942+ Fragment ,
3943+ Annotatable // ignore:deprecated_member_use_from_same_package
3944+ {
38863945 @override
38873946 TypeDefiningElement get element;
38883947
@@ -3943,7 +4002,11 @@ abstract class TypeParameterFragment implements TypeDefiningFragment {
39434002/// An element that has type parameters, such as a class, typedef, or method.
39444003///
39454004/// Clients may not extend, implement or mix-in this class.
3946- abstract class TypeParameterizedElement implements Element , Annotatable {
4005+ abstract class TypeParameterizedElement
4006+ implements
4007+ Element ,
4008+ Annotatable // ignore:deprecated_member_use_from_same_package
4009+ {
39474010 @override
39484011 TypeParameterizedFragment get firstFragment;
39494012
@@ -3982,7 +4045,11 @@ abstract class TypeParameterizedElement implements Element, Annotatable {
39824045/// declaration.
39834046///
39844047/// Clients may not extend, implement or mix-in this class.
3985- abstract class TypeParameterizedFragment implements Fragment , Annotatable {
4048+ abstract class TypeParameterizedFragment
4049+ implements
4050+ Fragment ,
4051+ Annotatable // ignore:deprecated_member_use_from_same_package
4052+ {
39864053 @override
39874054 TypeParameterizedElement get element;
39884055
0 commit comments