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 imoelihart
09/01/2021, 7:39 PMisProtected
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 PMJiaxiang
09/01/2021, 9:17 PMJiaxiang
09/01/2021, 9:20 PMIf you override amember and do not specify the visibility explicitly, the overriding member will also haveprotected
visibility.protected
Jiaxiang
09/01/2021, 9:25 PMpublic
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.Jiaxiang
09/01/2021, 9:29 PMinternal
, 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.Jiaxiang
09/01/2021, 9:31 PMpublic override
, otherwise it is still needed to look up for overridee.elihart
09/01/2021, 9:46 PM