Fail explicitly if a final method is invoked on a CGLIB proxy #26729
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
type: enhancement
A general enhancement
Milestone
Uh oh!
There was an error while loading. Please reload this page.
Started from spring-projects/spring-retry#238
In org.springframework.cglib.proxy.Enhancer.getMethods():
CollectionUtils.filter(methods, new RejectModifierPredicate(Constants.ACC_FINAL));
If the method is final it is SILENTLY rejected from being proxied.
Shouldn't we warn someone who is implementing a proxy on top of a final class ?
I believe it is a contract break of making the proxy and should throw a
NotProxiableElementException("The method or field is final.")
.This issue is particularly severe in Kotlin where
final
is the default.This example is using Spring-Retry to generate the Proxy and demonstrate the issue.
The text was updated successfully, but these errors were encountered: