-
Notifications
You must be signed in to change notification settings - Fork 26.4k
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
Optimize code to remove useless objects #7572
Conversation
Update RpcInvocation.java
@@ -160,15 +160,16 @@ public void setAttachmentIfAbsent(String key, String value) { | |||
attachments.put(key, value); | |||
} | |||
} | |||
|
|||
//Optimize code to remove useless objects |
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.
The comment is unnecessary
public void addAttachments(Map<String, String> attachments) { | ||
if (attachments == null) { | ||
return; | ||
} | ||
if (this.attachments == null) { | ||
this.attachments = new HashMap<String, String>(); | ||
this.attachments = attachments; | ||
}else{ |
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.
indent problem.
Update RpcInvocation.java
Codecov Report
@@ Coverage Diff @@
## master #7572 +/- ##
=========================================
Coverage ? 59.07%
Complexity ? 529
=========================================
Files ? 1076
Lines ? 43417
Branches ? 6339
=========================================
Hits ? 25648
Misses ? 14923
Partials ? 2846
Continue to review full report at Codecov.
|
Hi there, Happened to look through the release notes, but this merge introduced side effects. It assumes the argument |
yep, it's indeed risk. |
Optimize code to remove useless objects
update before
public void addAttachments(Map<String, String> attachments) {
if (attachments == null) {
return;
}
if (this.attachments == null) {
this.attachments = new HashMap<String, String>();
}
this.attachments.putAll(attachments);
}
update after
public void addAttachments(Map<String, String> attachments) {
if (attachments == null) {
return;
}
if (this.attachments == null) {
this.attachments = attachments;
}else{
this.attachments.putAll(attachments);
}
}