Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix fallback for suspended methods #8825

Merged

Conversation

ondrej-hrstka
Copy link
Contributor

Fixes #7101

@graemerocher graemerocher added this to the 3.8.6 milestone Feb 24, 2023
@dstepanov
Copy link
Contributor

Why does this not work by default? KotlinInterceptedMethod should fill the future if the value is not the coroutine:

  public CompletableFuture<Object> interceptResultAsCompletionStage() {
        @SuppressWarnings("unchecked")
        CompletableFutureContinuation completableFutureContinuation = new CompletableFutureContinuation((Continuation<Object>) continuation);
        replaceContinuation.accept(completableFutureContinuation);
        Object result = context.proceed();
        replaceContinuation.accept(continuation);
        if (result != KotlinUtils.COROUTINE_SUSPENDED) {
            completableFutureContinuation.resumeWith(result);
        }
        return completableFutureContinuation.getCompletableFuture();
    }
    ```

@ondrej-hrstka
Copy link
Contributor Author

@dstepanov : The problem is the fallback method. The 'MethodExecutionHandle' is located in 'findFallbackMethod' method. So for that one, there is no instance of 'KotlinInterceptedMethod'

@sdelamo sdelamo requested a review from graemerocher February 26, 2023 09:15
@graemerocher graemerocher merged commit 2c67fb2 into micronaut-projects:3.8.x Feb 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants