LI123456mo opened a new issue, #16330: URL: https://github.com/apache/dubbo/issues/16330
### Pre-check - [x] I am sure that all the content I provide is in English. ### Search before asking - [x] I had searched in the [issues](https://github.com/apache/dubbo/issues?q=is%3Aissue) and found no similar issues. ### Apache Dubbo Component Java SDK (apache/dubbo) ### Dubbo Version Any - this is a code inconsistency, not version specific. Observed in current main branch. ### Steps to reproduce this issue This is a code inconsistency found in StubServiceDescriptor.java in the findReflectionMethodDescriptor method. Location: dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/model/StubServiceDescriptor.java The isGeneric block assigns to a variable and returns at the end of the method: methodDescriptor = ServiceDescriptorInternalCache.genericService() .getMethods(methodName) .get(0); While the isEcho block returns immediately: return ServiceDescriptorInternalCache.echoService() .getMethods(methodName) .get(0); Both blocks do the same logical thing so they should be consistent. The generic block should also return immediately like the echo block. Suggested fix: return ServiceDescriptorInternalCache.genericService() .getMethods(methodName) .get(0); ### What you expected to happen Both the isGeneric and isEcho blocks should behave consistently since they do the same logical thing. The isGeneric block should return immediately like the isEcho block does, instead of assigning to a variable and waiting to return at the end of the method. ### Anything else This is a minor code inconsistency, not a functional bug. The code produces correct results either way, but the inconsistency makes the code harder to read and understand. The fix is a one line change in findReflectionMethodDescriptor: Current: methodDescriptor = ServiceDescriptorInternalCache.genericService() .getMethods(methodName) .get(0); Should be: return ServiceDescriptorInternalCache.genericService() .getMethods(methodName) .get(0); I am happy to submit a PR for this if maintainers agree. ### Do you have a (mini) reproduction demo? - [x] Yes, I have a minimal reproduction demo to help resolve this issue more effectively! ### Are you willing to submit a pull request to fix on your own? - [x] Yes I am willing to submit a pull request on my own! ### Code of Conduct - [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct) -- 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]
