Closed algomaster99 closed 2 months ago
ModifierKind
doesn't hold information about whether the modifier is implicit. CtExtendedModifier
holds that information in addition to the kind. So, if you only interested in which modifiers an element has, getModifiers()
might be enough, but if you want to know which explicit or implicit modifiers an element has (or whether it has a specific explicit modifier), you need getExtendedModifiers()
.
ModifierKind doesn't hold information about whether the modifier is implicit.
so getModifiers
could also return implicit modifiers?
so
getModifiers
could also return implicit modifiers?
Yes, they should both contain the same modifiers (i.e. getModifiers()
is equal to getExtendedModifiers().stream(CtExtendedModifier::getKind()).collect(...)
)
Thanks for answering!
I am wondering about the difference in the purpose of
getModifiers()
andgetExtendedModifiers()
. I understand that extended modifiers are spoon elements and they also hold source positions. However, it explicitly says that implicit modifiers are included. Does it mean thatgetModifiers
are supposed to ignore them? If yes, theabstract
modifier is returned for an interface bygetModifiers
even though it is implicit.