Skip to content

Commit 92f4e88

Browse files
committed
Merge branch '6.1.x'
2 parents dedc6a7 + c1d4b61 commit 92f4e88

File tree

3 files changed

+24
-33
lines changed

3 files changed

+24
-33
lines changed

Diff for: spring-core/src/main/java/org/springframework/core/CoroutinesUtils.java

+8-11
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@
2828
import kotlin.reflect.KClassifier;
2929
import kotlin.reflect.KFunction;
3030
import kotlin.reflect.KParameter;
31+
import kotlin.reflect.KType;
3132
import kotlin.reflect.full.KCallables;
3233
import kotlin.reflect.full.KClasses;
3334
import kotlin.reflect.jvm.KCallablesJvm;
35+
import kotlin.reflect.jvm.KTypesJvm;
3436
import kotlin.reflect.jvm.ReflectJvmMapping;
3537
import kotlinx.coroutines.BuildersKt;
3638
import kotlinx.coroutines.CoroutineStart;
@@ -117,19 +119,14 @@ public static Publisher<?> invokeSuspendingFunction(CoroutineContext context, Me
117119
case VALUE, EXTENSION_RECEIVER -> {
118120
Object arg = args[index];
119121
if (!(parameter.isOptional() && arg == null)) {
120-
if (parameter.getType().getClassifier() instanceof KClass<?> kClass) {
121-
Class<?> javaClass = JvmClassMappingKt.getJavaClass(kClass);
122-
if (KotlinDetector.isInlineClass(javaClass)
123-
&& !(parameter.getType().isMarkedNullable() && arg == null)) {
124-
argMap.put(parameter, KClasses.getPrimaryConstructor(kClass).call(arg));
122+
KType type = parameter.getType();
123+
if (!(type.isMarkedNullable() && arg == null)) {
124+
KClass<?> kClass = KTypesJvm.getJvmErasure(type);
125+
if (KotlinDetector.isInlineClass(JvmClassMappingKt.getJavaClass(kClass))) {
126+
arg = KClasses.getPrimaryConstructor(kClass).call(arg);
125127
}
126-
else {
127-
argMap.put(parameter, arg);
128-
}
129-
}
130-
else {
131-
argMap.put(parameter, arg);
132128
}
129+
argMap.put(parameter, arg);
133130
}
134131
index++;
135132
}

Diff for: spring-web/src/main/java/org/springframework/web/method/support/InvocableHandlerMethod.java

+8-11
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@
2626
import kotlin.reflect.KClass;
2727
import kotlin.reflect.KFunction;
2828
import kotlin.reflect.KParameter;
29+
import kotlin.reflect.KType;
2930
import kotlin.reflect.full.KClasses;
3031
import kotlin.reflect.jvm.KCallablesJvm;
32+
import kotlin.reflect.jvm.KTypesJvm;
3133
import kotlin.reflect.jvm.ReflectJvmMapping;
3234

3335
import org.springframework.context.MessageSource;
@@ -315,19 +317,14 @@ public static Object invokeFunction(Method method, Object target, Object[] args)
315317
case VALUE, EXTENSION_RECEIVER -> {
316318
Object arg = args[index];
317319
if (!(parameter.isOptional() && arg == null)) {
318-
if (parameter.getType().getClassifier() instanceof KClass<?> kClass) {
319-
Class<?> javaClass = JvmClassMappingKt.getJavaClass(kClass);
320-
if (KotlinDetector.isInlineClass(javaClass)
321-
&& !(parameter.getType().isMarkedNullable() && arg == null)) {
322-
argMap.put(parameter, KClasses.getPrimaryConstructor(kClass).call(arg));
320+
KType type = parameter.getType();
321+
if (!(type.isMarkedNullable() && arg == null)) {
322+
KClass<?> kClass = KTypesJvm.getJvmErasure(type);
323+
if (KotlinDetector.isInlineClass(JvmClassMappingKt.getJavaClass(kClass))) {
324+
arg = KClasses.getPrimaryConstructor(kClass).call(arg);
323325
}
324-
else {
325-
argMap.put(parameter, arg);
326-
}
327-
}
328-
else {
329-
argMap.put(parameter, arg);
330326
}
327+
argMap.put(parameter, arg);
331328
}
332329
index++;
333330
}

Diff for: spring-webflux/src/main/java/org/springframework/web/reactive/result/method/InvocableHandlerMethod.java

+8-11
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@
3131
import kotlin.reflect.KClass;
3232
import kotlin.reflect.KFunction;
3333
import kotlin.reflect.KParameter;
34+
import kotlin.reflect.KType;
3435
import kotlin.reflect.full.KClasses;
3536
import kotlin.reflect.jvm.KCallablesJvm;
37+
import kotlin.reflect.jvm.KTypesJvm;
3638
import kotlin.reflect.jvm.ReflectJvmMapping;
3739
import reactor.core.publisher.Mono;
3840

@@ -326,19 +328,14 @@ public static Object invokeFunction(Method method, Object target, Object[] args,
326328
case VALUE, EXTENSION_RECEIVER -> {
327329
Object arg = args[index];
328330
if (!(parameter.isOptional() && arg == null)) {
329-
if (parameter.getType().getClassifier() instanceof KClass<?> kClass) {
330-
Class<?> javaClass = JvmClassMappingKt.getJavaClass(kClass);
331-
if (KotlinDetector.isInlineClass(javaClass)
332-
&& !(parameter.getType().isMarkedNullable() && arg == null)) {
333-
argMap.put(parameter, KClasses.getPrimaryConstructor(kClass).call(arg));
331+
KType type = parameter.getType();
332+
if (!(type.isMarkedNullable() && arg == null)) {
333+
KClass<?> kClass = KTypesJvm.getJvmErasure(type);
334+
if (KotlinDetector.isInlineClass(JvmClassMappingKt.getJavaClass(kClass))) {
335+
arg = KClasses.getPrimaryConstructor(kClass).call(arg);
334336
}
335-
else {
336-
argMap.put(parameter, arg);
337-
}
338-
}
339-
else {
340-
argMap.put(parameter, arg);
341337
}
338+
argMap.put(parameter, arg);
342339
}
343340
index++;
344341
}

0 commit comments

Comments
 (0)