This is an automated email from the ASF dual-hosted git repository.
albumenj pushed a commit to branch 3.2
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/3.2 by this push:
new a342f67dc0 fix async method call ClassCastException error (#13932)
a342f67dc0 is described below
commit a342f67dc04fea2a5e6cfadba8392a43ca2f2546
Author: foghost <[email protected]>
AuthorDate: Tue Mar 19 09:38:06 2024 +0800
fix async method call ClassCastException error (#13932)
---
.../dubbo/registry/client/ServiceDiscoveryRegistryDirectory.java | 6 ++++++
1 file changed, 6 insertions(+)
diff --git
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/ServiceDiscoveryRegistryDirectory.java
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/ServiceDiscoveryRegistryDirectory.java
index 224b224022..b743a1c30e 100644
---
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/ServiceDiscoveryRegistryDirectory.java
+++
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/ServiceDiscoveryRegistryDirectory.java
@@ -778,6 +778,12 @@ public class ServiceDiscoveryRegistryDirectory<T> extends
DynamicDirectory<T> {
invocation instanceof RpcInvocation ? ((RpcInvocation)
invocation).getInvokeMode() : null);
copiedInvocation.setObjectAttachment(CommonConstants.GROUP_KEY,
protocolServiceKey.getGroup());
copiedInvocation.setObjectAttachment(CommonConstants.VERSION_KEY,
protocolServiceKey.getVersion());
+ // When there are multiple MethodDescriptors with the same method
name, the return type will be wrong
+ // same with org.apache.dubbo.rpc.stub.StubInvocationUtil.call
+ // fix https://github.com/apache/dubbo/issues/13931
+ if (invocation instanceof RpcInvocation) {
+ copiedInvocation.setReturnType(((RpcInvocation)
invocation).getReturnType());
+ }
return originInvoker.invoke(copiedInvocation);
}