You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aurora.apache.org by se...@apache.org on 2016/10/18 20:18:52 UTC
aurora git commit: Check identity before comparing fields In
immutable Thrift structs.
Repository: aurora
Updated Branches:
refs/heads/master 8c1200894 -> 485504a20
Check identity before comparing fields In immutable Thrift structs.
I saw THRIFT-3868 and thought we could apply the same micro-optimization
as well. Details: https://github.com/apache/thrift/pull/1106
Example of a generated equals method (in ITaskConfig):
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof ITaskConfig)) {
return false;
}
ITaskConfig other = (ITaskConfig) o;
return Objects.equals(job, other.job)
&& Objects.equals(owner, other.owner)
&& Objects.equals(isService, other.isService)
&& Objects.equals(numCpus, other.numCpus)
&& Objects.equals(ramMb, other.ramMb)
&& Objects.equals(diskMb, other.diskMb)
&& Objects.equals(priority, other.priority)
&& Objects.equals(maxTaskFailures, other.maxTaskFailures)
&& Objects.equals(production, other.production)
&& Objects.equals(tier, other.tier)
&& Objects.equals(resources, other.resources)
&& Objects.equals(constraints, other.constraints)
&& Objects.equals(requestedPorts, other.requestedPorts)
&& Objects.equals(mesosFetcherUris, other.mesosFetcherUris)
&& Objects.equals(taskLinks, other.taskLinks)
&& Objects.equals(contactEmail, other.contactEmail)
&& Objects.equals(executorConfig, other.executorConfig)
&& Objects.equals(metadata, other.metadata)
&& Objects.equals(container, other.container);
}
Reviewed at https://reviews.apache.org/r/52921/
Project: http://git-wip-us.apache.org/repos/asf/aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/aurora/commit/485504a2
Tree: http://git-wip-us.apache.org/repos/asf/aurora/tree/485504a2
Diff: http://git-wip-us.apache.org/repos/asf/aurora/diff/485504a2
Branch: refs/heads/master
Commit: 485504a205d6cc1f17a115d41290dde49942dade
Parents: 8c12008
Author: Stephan Erb <se...@apache.org>
Authored: Tue Oct 18 22:18:32 2016 +0200
Committer: Stephan Erb <se...@apache.org>
Committed: Tue Oct 18 22:18:32 2016 +0200
----------------------------------------------------------------------
.../python/apache/aurora/tools/java/thrift_wrapper_codegen.py | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/aurora/blob/485504a2/src/main/python/apache/aurora/tools/java/thrift_wrapper_codegen.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/tools/java/thrift_wrapper_codegen.py b/src/main/python/apache/aurora/tools/java/thrift_wrapper_codegen.py
index 7c28180..1efef2d 100644
--- a/src/main/python/apache/aurora/tools/java/thrift_wrapper_codegen.py
+++ b/src/main/python/apache/aurora/tools/java/thrift_wrapper_codegen.py
@@ -218,6 +218,9 @@ public final class %(name)s {
@Override
public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
if (!(o instanceof %(name)s)) {
return false;
}