Replace getJvmErasure by getClassifier
Should be slightly faster. See gh-32334
This commit is contained in:
@@ -29,7 +29,6 @@ import kotlin.reflect.KParameter;
|
||||
import kotlin.reflect.KType;
|
||||
import kotlin.reflect.full.KClasses;
|
||||
import kotlin.reflect.jvm.KCallablesJvm;
|
||||
import kotlin.reflect.jvm.KTypesJvm;
|
||||
import kotlin.reflect.jvm.ReflectJvmMapping;
|
||||
|
||||
import org.springframework.context.MessageSource;
|
||||
@@ -299,7 +298,7 @@ public class InvocableHandlerMethod extends HandlerMethod {
|
||||
private static class KotlinDelegate {
|
||||
|
||||
@Nullable
|
||||
@SuppressWarnings("deprecation")
|
||||
@SuppressWarnings({"deprecation", "DataFlowIssue"})
|
||||
public static Object invokeFunction(Method method, Object target, Object[] args) throws InvocationTargetException, IllegalAccessException {
|
||||
KFunction<?> function = ReflectJvmMapping.getKotlinFunction(method);
|
||||
// For property accessors
|
||||
@@ -319,7 +318,7 @@ public class InvocableHandlerMethod extends HandlerMethod {
|
||||
if (!(parameter.isOptional() && arg == null)) {
|
||||
KType type = parameter.getType();
|
||||
if (!(type.isMarkedNullable() && arg == null)) {
|
||||
KClass<?> kClass = KTypesJvm.getJvmErasure(type);
|
||||
KClass<?> kClass = (KClass<?>) type.getClassifier();
|
||||
if (KotlinDetector.isInlineClass(JvmClassMappingKt.getJavaClass(kClass))) {
|
||||
arg = KClasses.getPrimaryConstructor(kClass).call(arg);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user