Make it possible to run Spring MVC without kotlin-reflect

Closes gh-24828
This commit is contained in:
Sébastien Deleuze 2020-04-14 14:56:21 +02:00
parent 3aa7f45738
commit 884c7696ce
1 changed files with 5 additions and 2 deletions

View File

@ -591,8 +591,11 @@ public abstract class AbstractHandlerMethodMapping<T> extends AbstractHandlerMap
public void register(T mapping, Object handler, Method method) {
// Assert that the handler method is not a suspending one.
if (KotlinDetector.isKotlinType(method.getDeclaringClass()) && KotlinDelegate.isSuspend(method)) {
throw new IllegalStateException("Unsupported suspending handler method detected: " + method);
if (KotlinDetector.isKotlinType(method.getDeclaringClass())) {
Class<?>[] parameterTypes = method.getParameterTypes();
if ((parameterTypes.length > 0) && "kotlin.coroutines.Continuation".equals(parameterTypes[parameterTypes.length - 1].getName())) {
throw new IllegalStateException("Unsupported suspending handler method detected: " + method);
}
}
this.readWriteLock.writeLock().lock();
try {