From abb296c7d2ed89a00ee64d4303c7c1d994c416f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deleuze?= Date: Tue, 12 Sep 2023 18:59:37 +0200 Subject: [PATCH] Remove Java code dependency on CoWebFilter To avoid compilation errors in Eclipse which does not support Java code dependency on Kotlin code. See gh-27522 --- .../web/reactive/result/method/InvocableHandlerMethod.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/InvocableHandlerMethod.java b/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/InvocableHandlerMethod.java index 66fb38ecb7b9..63dbb80a5510 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/InvocableHandlerMethod.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/InvocableHandlerMethod.java @@ -49,7 +49,6 @@ import org.springframework.web.method.HandlerMethod; import org.springframework.web.reactive.BindingContext; import org.springframework.web.reactive.HandlerResult; -import org.springframework.web.server.CoWebFilter; import org.springframework.web.server.ServerWebExchange; /** @@ -292,13 +291,16 @@ private boolean isResponseHandled(Object[] args, ServerWebExchange exchange) { */ private static class KotlinDelegate { + // Copy of CoWebFilter.COROUTINE_CONTEXT_ATTRIBUTE value to avoid compilation errors in Eclipse + private static final String COROUTINE_CONTEXT_ATTRIBUTE = "org.springframework.web.server.CoWebFilter.context"; + @Nullable @SuppressWarnings("deprecation") public static Object invokeFunction(Method method, Object target, Object[] args, boolean isSuspendingFunction, ServerWebExchange exchange) { if (isSuspendingFunction) { - Object coroutineContext = exchange.getAttribute(CoWebFilter.COROUTINE_CONTEXT_ATTRIBUTE); + Object coroutineContext = exchange.getAttribute(COROUTINE_CONTEXT_ATTRIBUTE); if (coroutineContext == null) { return CoroutinesUtils.invokeSuspendingFunction(method, target, args); }