-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Document intention of toString()
in HandlerMethod
#35055
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
Document intention of toString()
in HandlerMethod
#35055
Conversation
The `formatErrorForReturnValue` method in `ServletInvocableHandlerMethod` previously included an unnecessary call to `toString()` and a dangling "in" at the end of the formatted string. Since the surrounding context already provides sufficient information, both the `toString()` call and the `" in"` suffix have been removed to improve clarity. No functional changes. Signed-off-by: wonyongg <[email protected]>
After revisiting the HandlerMethod implementation, I realized that I misunderstood the original purpose of the Initially, I thought the usage of That said, I'd like to propose a small improvement. The method name The output remains similar, but the method name communicates its purpose more directly. If this suggestion doesn't align with the direction of the project, please feel free to suggest an alternative approach or close this PR if it's unnecessary. |
toString()
call and trailing "in" from error message
I'm not so sure that it's worth changing things here. If we were to change something, I suppose we could either make the We'll discuss it within the team and get back to you. |
toString()
usage in log messages in HandlerMethod
@sbrannen |
Instead of changing the code or introducing a dedicated method to retrieve the If you would like to repurpose this PR to do that, feel free to do so. Otherwise, I'll just add the Javadoc myself. |
Document that HandlerMethod.toString() is used in log and error messages, and that the returned description should typically include the method signature of the underlying handler method for clarity and debugging. Signed-off-by: wonyongg <[email protected]>
Thanks for the feedback! 🙏 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the proposed Javadoc.
I've requested minor changes.
spring-web/src/main/java/org/springframework/web/method/HandlerMethod.java
Outdated
Show resolved
Hide resolved
toString()
usage in log messages in HandlerMethod
toString()
in HandlerMethod
…rMethod.java Co-authored-by: Sam Brannen <[email protected]> Signed-off-by: WonYong Hwang <[email protected]>
This has been merged into Thanks |
The
formatErrorForReturnValue
method inServletInvocableHandlerMethod
previously included an unnecessary call totoString()
and a dangling "in" at the end of the formatted string.Since the surrounding context already provides sufficient information, both the
toString()
call and the" in"
suffix have been removed to improve clarity.No functional changes.