[ https://issues.apache.org/jira/browse/TEZ-3687?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Akira Ajisaka reassigned TEZ-3687: ---------------------------------- Assignee: Akira Ajisaka > Code smell in equals implementation > ----------------------------------- > > Key: TEZ-3687 > URL: https://issues.apache.org/jira/browse/TEZ-3687 > Project: Apache Tez > Issue Type: Bug > Reporter: JC > Assignee: Akira Ajisaka > Priority: Trivial > > Hi > In a recent snapshot mirrored from GitHub (tez), I've found code smells that > may case a bug. > Path: tez-api/src/main/java/org/apache/tez/dag/api/client/DAGStatus.java > {code} > 161 public boolean equals(Object obj) { > 162 // Source explicitly exclude from equals > 163 if (obj instanceof DAGStatus){ > 164 DAGStatus other = (DAGStatus)obj; > 165 return getState() == other.getState() > 166 && getDiagnostics().equals(other.getDiagnostics()) > 167 && getDAGProgress().equals(getDAGProgress()) > 168 && getVertexProgress().equals(getVertexProgress()) > 169 && > 170 ((getDAGCounters() == null && other.getDAGCounters() == null) > 171 || getDAGCounters().equals(other.getDAGCounters())); > 172 } > 173 return false; > 174 } > {code} > In Line 167 and 168, the conditions should be > getDAGProgress().equals(other.getDAGProgress()) > getVertexProgress().equals(other.getVertexProgress()) > respectively? > Path: tez-api/src/main/java/org/apache/tez/dag/api/client/VertexStatus.java > {code} > 119 public boolean equals(Object obj) { > 120 if (obj instanceof VertexStatus){ > 121 VertexStatus other = (VertexStatus)obj; > 122 return getState().equals(other.getState()) > 123 && getDiagnostics().equals(getDiagnostics()) > 124 && getProgress().equals(getProgress()) > 125 && > 126 ((getVertexCounters() == null && other.getVertexCounters() == > null) > 127 || getVertexCounters().equals(other.getVertexCounters())); > 128 } > 129 return false; > 130 } > {code} > in In Line 123 and 124, the conditions should be > getDiagnostics().equals(other.getDiagnostics()) > getProgress().equals(other.getProgress()) > respectively? > These might be trivial things but wanted to report just in case. Thanks! -- This message was sent by Atlassian JIRA (v6.3.15#6346)