Ashutosh-Panda2004 opened a new pull request, #16508: URL: https://github.com/apache/dubbo/pull/16508
This fixes #16501. ReflectUtils.getReturnTypes cast the payload type of a Future return directly to Class. That works for a plain payload like CompletableFuture<String>, but a wildcard payload such as CompletableFuture<? extends CharSequence> and a generic array payload such as CompletableFuture<T[]> are not Class instances, so the cast threw ClassCastException. ReflectionMethodDescriptor caught it and recorded CompletableFuture itself as the response type, so the actual payload type was lost. I changed getReturnTypes to resolve the payload raw class recursively instead of casting. A parameterized type resolves to its raw type, a type variable and a wildcard resolve to the raw class of their first upper bound, and a generic array resolves to the array class of its resolved component type. So the wildcard signature now gives CharSequence and the generic array gives Object[], and the existing cases (plain class, parameterized type, type variable) behave exactly as before. I added regression tests to ReflectUtilsTest for the wildcard and generic array signatures, and a test in ReflectionMethodDescriptorTest showing the descriptor now records CharSequence for the wildcard method instead of CompletableFuture. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
