Polishing (aligned with main)

This commit is contained in:
Juergen Hoeller 2024-03-19 10:05:32 +01:00
parent c531a8a705
commit bd27ddf83a
1 changed files with 3 additions and 4 deletions

View File

@ -19,7 +19,6 @@ package org.springframework.core;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Map;
import java.util.Objects;
import kotlin.Unit;
import kotlin.coroutines.CoroutineContext;
@ -93,8 +92,7 @@ public abstract class CoroutinesUtils {
* @return the method invocation result as reactive stream
* @throws IllegalArgumentException if {@code method} is not a suspending function
*/
public static Publisher<?> invokeSuspendingFunction(Method method, Object target,
Object... args) {
public static Publisher<?> invokeSuspendingFunction(Method method, Object target, Object... args) {
return invokeSuspendingFunction(Dispatchers.getUnconfined(), method, target, args);
}
@ -115,7 +113,8 @@ public abstract class CoroutinesUtils {
CoroutineContext context, Method method, @Nullable Object target, Object... args) {
Assert.isTrue(KotlinDetector.isSuspendingFunction(method), "Method must be a suspending function");
KFunction<?> function = Objects.requireNonNull(ReflectJvmMapping.getKotlinFunction(method));
KFunction<?> function = ReflectJvmMapping.getKotlinFunction(method);
Assert.notNull(function, () -> "Failed to get Kotlin function for method: " + method);
if (method.isAccessible() && !KCallablesJvm.isAccessible(function)) {
KCallablesJvm.setAccessible(function, true);
}