Merge branch '6.1.x'

This commit is contained in:
Sébastien Deleuze 2024-03-07 11:11:46 +01:00
commit 92f4e883b3
3 changed files with 24 additions and 33 deletions

View File

@ -28,9 +28,11 @@ import kotlin.reflect.KClass;
import kotlin.reflect.KClassifier; import kotlin.reflect.KClassifier;
import kotlin.reflect.KFunction; import kotlin.reflect.KFunction;
import kotlin.reflect.KParameter; import kotlin.reflect.KParameter;
import kotlin.reflect.KType;
import kotlin.reflect.full.KCallables; import kotlin.reflect.full.KCallables;
import kotlin.reflect.full.KClasses; import kotlin.reflect.full.KClasses;
import kotlin.reflect.jvm.KCallablesJvm; import kotlin.reflect.jvm.KCallablesJvm;
import kotlin.reflect.jvm.KTypesJvm;
import kotlin.reflect.jvm.ReflectJvmMapping; import kotlin.reflect.jvm.ReflectJvmMapping;
import kotlinx.coroutines.BuildersKt; import kotlinx.coroutines.BuildersKt;
import kotlinx.coroutines.CoroutineStart; import kotlinx.coroutines.CoroutineStart;
@ -117,19 +119,14 @@ public abstract class CoroutinesUtils {
case VALUE, EXTENSION_RECEIVER -> { case VALUE, EXTENSION_RECEIVER -> {
Object arg = args[index]; Object arg = args[index];
if (!(parameter.isOptional() && arg == null)) { if (!(parameter.isOptional() && arg == null)) {
if (parameter.getType().getClassifier() instanceof KClass<?> kClass) { KType type = parameter.getType();
Class<?> javaClass = JvmClassMappingKt.getJavaClass(kClass); if (!(type.isMarkedNullable() && arg == null)) {
if (KotlinDetector.isInlineClass(javaClass) KClass<?> kClass = KTypesJvm.getJvmErasure(type);
&& !(parameter.getType().isMarkedNullable() && arg == null)) { if (KotlinDetector.isInlineClass(JvmClassMappingKt.getJavaClass(kClass))) {
argMap.put(parameter, KClasses.getPrimaryConstructor(kClass).call(arg)); arg = KClasses.getPrimaryConstructor(kClass).call(arg);
}
else {
argMap.put(parameter, arg);
} }
} }
else { argMap.put(parameter, arg);
argMap.put(parameter, arg);
}
} }
index++; index++;
} }

View File

@ -26,8 +26,10 @@ import kotlin.jvm.JvmClassMappingKt;
import kotlin.reflect.KClass; import kotlin.reflect.KClass;
import kotlin.reflect.KFunction; import kotlin.reflect.KFunction;
import kotlin.reflect.KParameter; import kotlin.reflect.KParameter;
import kotlin.reflect.KType;
import kotlin.reflect.full.KClasses; import kotlin.reflect.full.KClasses;
import kotlin.reflect.jvm.KCallablesJvm; import kotlin.reflect.jvm.KCallablesJvm;
import kotlin.reflect.jvm.KTypesJvm;
import kotlin.reflect.jvm.ReflectJvmMapping; import kotlin.reflect.jvm.ReflectJvmMapping;
import org.springframework.context.MessageSource; import org.springframework.context.MessageSource;
@ -315,19 +317,14 @@ public class InvocableHandlerMethod extends HandlerMethod {
case VALUE, EXTENSION_RECEIVER -> { case VALUE, EXTENSION_RECEIVER -> {
Object arg = args[index]; Object arg = args[index];
if (!(parameter.isOptional() && arg == null)) { if (!(parameter.isOptional() && arg == null)) {
if (parameter.getType().getClassifier() instanceof KClass<?> kClass) { KType type = parameter.getType();
Class<?> javaClass = JvmClassMappingKt.getJavaClass(kClass); if (!(type.isMarkedNullable() && arg == null)) {
if (KotlinDetector.isInlineClass(javaClass) KClass<?> kClass = KTypesJvm.getJvmErasure(type);
&& !(parameter.getType().isMarkedNullable() && arg == null)) { if (KotlinDetector.isInlineClass(JvmClassMappingKt.getJavaClass(kClass))) {
argMap.put(parameter, KClasses.getPrimaryConstructor(kClass).call(arg)); arg = KClasses.getPrimaryConstructor(kClass).call(arg);
}
else {
argMap.put(parameter, arg);
} }
} }
else { argMap.put(parameter, arg);
argMap.put(parameter, arg);
}
} }
index++; index++;
} }

View File

@ -31,8 +31,10 @@ import kotlin.jvm.JvmClassMappingKt;
import kotlin.reflect.KClass; import kotlin.reflect.KClass;
import kotlin.reflect.KFunction; import kotlin.reflect.KFunction;
import kotlin.reflect.KParameter; import kotlin.reflect.KParameter;
import kotlin.reflect.KType;
import kotlin.reflect.full.KClasses; import kotlin.reflect.full.KClasses;
import kotlin.reflect.jvm.KCallablesJvm; import kotlin.reflect.jvm.KCallablesJvm;
import kotlin.reflect.jvm.KTypesJvm;
import kotlin.reflect.jvm.ReflectJvmMapping; import kotlin.reflect.jvm.ReflectJvmMapping;
import reactor.core.publisher.Mono; import reactor.core.publisher.Mono;
@ -326,19 +328,14 @@ public class InvocableHandlerMethod extends HandlerMethod {
case VALUE, EXTENSION_RECEIVER -> { case VALUE, EXTENSION_RECEIVER -> {
Object arg = args[index]; Object arg = args[index];
if (!(parameter.isOptional() && arg == null)) { if (!(parameter.isOptional() && arg == null)) {
if (parameter.getType().getClassifier() instanceof KClass<?> kClass) { KType type = parameter.getType();
Class<?> javaClass = JvmClassMappingKt.getJavaClass(kClass); if (!(type.isMarkedNullable() && arg == null)) {
if (KotlinDetector.isInlineClass(javaClass) KClass<?> kClass = KTypesJvm.getJvmErasure(type);
&& !(parameter.getType().isMarkedNullable() && arg == null)) { if (KotlinDetector.isInlineClass(JvmClassMappingKt.getJavaClass(kClass))) {
argMap.put(parameter, KClasses.getPrimaryConstructor(kClass).call(arg)); arg = KClasses.getPrimaryConstructor(kClass).call(arg);
}
else {
argMap.put(parameter, arg);
} }
} }
else { argMap.put(parameter, arg);
argMap.put(parameter, arg);
}
} }
index++; index++;
} }