walterlife commented on code in PR #2550:
URL:
https://github.com/apache/incubator-eventmesh/pull/2550#discussion_r1045334987
##########
eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/tcp/UserAgent.java:
##########
@@ -136,18 +136,17 @@ public boolean equals(Object o) {
@Override
public int hashCode() {
int result = subsystem != null ? subsystem.hashCode() : 0;
- result = 31 * result + (group != null ? group.hashCode() : 0);
- result = 31 * result + (path != null ? path.hashCode() : 0);
- result = 31 * result + pid;
- result = 31 * result + (host != null ? host.hashCode() : 0);
- result = 31 * result + (purpose != null ? purpose.hashCode() : 0);
- result = 31 * result + port;
- result = 31 * result + (version != null ? version.hashCode() : 0);
- result = 31 * result + (username != null ? username.hashCode() : 0);
- result = 31 * result + (password != null ? password.hashCode() : 0);
- result = 31 * result + (idc != null ? idc.hashCode() : 0);
- result = 31 * result + (env != null ? env.hashCode() : 0);
- result = 31 * result + unack;
- return result;
+ return (((((((((((result * 31 + (group != null ? group.hashCode() : 0))
Review Comment:
1. The original code has no performance problems, and code style problems
2. Although the modified code looks more concise, it actually has some side
effects. For example, a single line is too complex, the readability is poor,
and the testability is poor.
If you want to know more details, it is recommended to read the google code
review guide in depth.
https://google.github.io/eng-practices/review/reviewer/looking-for.html#complexity
--
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]