AopUtils.getMostSpecificMethod does not return original method for proxy-derived method anymore #32365
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
status: backported
An issue that has been backported to maintenance branches
type: regression
A bug that is also a regression
Milestone
Affects: 5.3.30, 5.3.31, 5.3.32
Since 5.3.30
AopUtils.getMostSpecificMethod
is no longer giving the correct result in our code. The problem was introduced in recent changes toClassUtils.getMostSpecificMethod
in the check to determine if the method is overridable and to only continue the search if it is - if it is not overridable then it is assumed that it is already the most specific method and returns it. However, this is not the correct logic in some cases.In our case the method passed in comes from a runtime-generated Proxy and we use this util to get the original method (with generic params intact). This generated method appears to have a
final
modifier - thus is not considered overridable by the new code. I don't think this is the correct logic as the original method is in fact overridable - it has been overriden by the generated method. Previously, thefinal
modifier was not considered so the logic was effectively "this method could not have been overriden". Now, the logic is "this method cannot be overriden further".Minimal test case (passes on 5.3.29, fails on 5.3.30+):
The text was updated successfully, but these errors were encountered: