elihart
09/01/2021, 7:38 PMKSDeclaration.getVisibility()
returns the visibility of the original declaration by looking up the overridee if the declaration is an override. I was expecting, and hoping, to get the visibility of an overridden function and was pretty confused by this behavior.
Why was this approach chosen? It seems like a strange default. I suppose we can check modifiers directly to get visibility of a overridden declaration but it’s not ideal imoisProtected
and isPublic
cannot show overridden visibility, and since modifiers are not exposed it doesn’t seem possible with XProcessing to get the visibility of overridden functions right nowyigit
09/01/2021, 8:29 PMJiaxiang
09/01/2021, 9:16 PMIf you override amember and do not specify the visibility explicitly, the overriding member will also haveprotected
visibility.protected
public
and is the maximum possible visibility, and internal
and protected
is not compatible to each other therefore you can’t change it from one to another at override site.internal
, you need to use public override
to make it public. So look up is also needed for internal
overridee. Somehow this is not documented in the aforementioned doc.public override
, otherwise it is still needed to look up for overridee.elihart
09/01/2021, 9:46 PM