Support Kotlin synthetic classes in MethodParameter and SpEL
Closes gh-23812
This commit is contained in:
@@ -908,9 +908,14 @@ public class MethodParameter {
|
||||
* functions via Kotlin reflection.
|
||||
*/
|
||||
static private Type getGenericReturnType(Method method) {
|
||||
KFunction<?> function = ReflectJvmMapping.getKotlinFunction(method);
|
||||
if (function != null && function.isSuspend()) {
|
||||
return ReflectJvmMapping.getJavaType(function.getReturnType());
|
||||
try {
|
||||
KFunction<?> function = ReflectJvmMapping.getKotlinFunction(method);
|
||||
if (function != null && function.isSuspend()) {
|
||||
return ReflectJvmMapping.getJavaType(function.getReturnType());
|
||||
}
|
||||
}
|
||||
catch (UnsupportedOperationException ex) {
|
||||
// probably a synthetic class - let's use java reflection instead
|
||||
}
|
||||
return method.getGenericReturnType();
|
||||
}
|
||||
@@ -920,10 +925,15 @@ public class MethodParameter {
|
||||
* functions via Kotlin reflection.
|
||||
*/
|
||||
static private Class<?> getReturnType(Method method) {
|
||||
KFunction<?> function = ReflectJvmMapping.getKotlinFunction(method);
|
||||
if (function != null && function.isSuspend()) {
|
||||
Type paramType = ReflectJvmMapping.getJavaType(function.getReturnType());
|
||||
return ResolvableType.forType(paramType).resolve(method.getReturnType());
|
||||
try {
|
||||
KFunction<?> function = ReflectJvmMapping.getKotlinFunction(method);
|
||||
if (function != null && function.isSuspend()) {
|
||||
Type paramType = ReflectJvmMapping.getJavaType(function.getReturnType());
|
||||
return ResolvableType.forType(paramType).resolve(method.getReturnType());
|
||||
}
|
||||
}
|
||||
catch (UnsupportedOperationException ex) {
|
||||
// probably a synthetic class - let's use java reflection instead
|
||||
}
|
||||
return method.getReturnType();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user