Fix a regression in Cglib Kotlin proxies

The commit skips using UndeclaredThrowableStrategy for
Kotlin classes in CglibAopProxy in order to fix a
related regression caused by gh-32469.

See gh-33585
This commit is contained in:
Sébastien Deleuze
2024-10-03 19:49:59 +02:00
parent 02094b258c
commit eebaa3538a
2 changed files with 70 additions and 1 deletions

View File

@@ -206,7 +206,10 @@ class CglibAopProxy implements AopProxy, Serializable {
enhancer.setInterfaces(AopProxyUtils.completeProxiedInterfaces(this.advised));
enhancer.setNamingPolicy(SpringNamingPolicy.INSTANCE);
enhancer.setAttemptLoad(true);
enhancer.setStrategy(new ClassLoaderAwareGeneratorStrategy(classLoader, undeclaredThrowableStrategy));
enhancer.setStrategy(KotlinDetector.isKotlinType(proxySuperClass) ?
new ClassLoaderAwareGeneratorStrategy(classLoader) :
new ClassLoaderAwareGeneratorStrategy(classLoader, undeclaredThrowableStrategy)
);
Callback[] callbacks = getCallbacks(rootClass);
Class<?>[] types = new Class<?>[callbacks.length];