You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An instance method mC declared in class C overrides another instance method mA declared in class A iff either mC is the same as mA, or all of the following are true:
C is a subclass of A.
mC has the same name and descriptor as mA.
mC is not marked ACC_PRIVATE.
One of the following is true:
mA is marked ACC_PUBLIC; or is marked ACC_PROTECTED; or is marked neither ACC_PUBLIC nor ACC_PROTECTED nor ACC_PRIVATE and A belongs to the same run-time package as C.
mC overrides a method m' (m' distinct from mC and mA) such that m' overrides mA.
In particular, the bolded bullet point above is false in the example mentioned in #2254 (comment), so I think Resolver#overrides(methodC, methodA) should also give false.
bcorso
changed the title
Resolver#overrides() gives incorrect result when method isn't accessible.
[KSP2] Resolver#overrides() gives incorrect result when method isn't accessible.
Dec 11, 2024
Consider the following two classes:
When using
Resolver#overrides(methodC, methodA)
we get different results in KSP1 and KSP2:Resolver#overrides(methodC, methodA) == false
Resolver#overrides(methodC, methodA) == true
I think KSP2's result is wrong in this case because
A#method()
is not visible from classB
, so rather than an override it's more like shadowing.The text was updated successfully, but these errors were encountered: