Skip to content

Resolve bridge methods for multi-level generic Kotlin suspend overrides - #37368

Closed
Asthenia0412 wants to merge 1 commit into
spring-projects:mainfrom
Asthenia0412:fix/bridge-resolver-kotlin-suspend
Closed

Asthenia0412 wants to merge 1 commit into
spring-projects:mainfrom
Asthenia0412:fix/bridge-resolver-kotlin-suspend

Conversation

@Asthenia0412

Copy link
Copy Markdown

Overview

BridgeMethodResolver.checkResolvedTypeMatch compares the resolved generic return type against the candidate method's JVM return type. For Kotlin suspending functions, the JVM return type is always Object regardless of the declared return type, so the return type check rejects valid candidates in multi-level generic hierarchies where multiple non-bridge candidates exist.

This is the multi-implementation counterpart of #33045: the single-candidate shortcut returns the candidate directly, but the candidate-search path performs the return type check and fails for Kotlin suspend functions.

Changes

In checkResolvedTypeMatch, skip the return type check when the candidate method is a Kotlin suspending function (detected via KotlinDetector.isSuspendingFunction). The parameter type match still selects the correct bridged method.

Related Issue

BridgeMethodResolver.checkResolvedTypeMatch compares the resolved generic
return type against the candidate method's JVM return type. For Kotlin
suspending functions, the JVM return type is always Object regardless of
the declared return type, so the return type check rejects valid candidates
in multi-level generic hierarchies where multiple non-bridge candidates exist.

Skip the return type check when the candidate method is a Kotlin suspending
function (detected via KotlinDetector.isSuspendingFunction), allowing the
parameter type match to select the correct bridged method.

Closes spring-projectsgh-37125
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Oct 1, 2026
@bclozel bclozel closed this Oct 1, 2026
@sbrannen sbrannen added status: declined A suggestion or change that we don't feel we should currently apply and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: declined A suggestion or change that we don't feel we should currently apply

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants