Skip to content

Commit 81317f4

Browse files
committed
hopefully better behavior in sets + easier to debug
1 parent 9b5643a commit 81317f4

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

soot-infoflow/src/soot/jimple/infoflow/problems/TaintPropagationResults.java

+40
Original file line numberDiff line numberDiff line change
@@ -127,4 +127,44 @@ public int size() {
127127
return results == null ? 0 : results.size();
128128
}
129129

130+
@Override
131+
public int hashCode() {
132+
final int prime = 31;
133+
int result = 1;
134+
result = prime * result + ((results == null) ? 0 : results.hashCode());
135+
return result;
136+
}
137+
138+
@Override
139+
public boolean equals(Object obj) {
140+
if (this == obj)
141+
return true;
142+
if (obj == null)
143+
return false;
144+
if (getClass() != obj.getClass())
145+
return false;
146+
TaintPropagationResults other = (TaintPropagationResults) obj;
147+
if (results == null) {
148+
if (other.results != null)
149+
return false;
150+
} else if (!results.equals(other.results))
151+
return false;
152+
return true;
153+
}
154+
155+
@Override
156+
public String toString() {
157+
StringBuilder sb = new StringBuilder();
158+
if (results != null && !results.isEmpty()) {
159+
for (AbstractionAtSink aas : results.keySet()) {
160+
sb.append("Abstraction: ");
161+
sb.append(aas.getAbstraction());
162+
sb.append(" at ");
163+
sb.append(aas.getSinkStmt());
164+
sb.append("\n");
165+
}
166+
}
167+
return sb.toString();
168+
}
169+
130170
}

0 commit comments

Comments
 (0)