misc: don't add same edge insn several times
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package jadx.core.dex.attributes.nodes;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import jadx.core.dex.attributes.AType;
|
||||
import jadx.core.dex.attributes.AttrList;
|
||||
import jadx.core.dex.attributes.IAttribute;
|
||||
@@ -14,8 +16,12 @@ public class EdgeInsnAttr implements IAttribute {
|
||||
|
||||
public static void addEdgeInsn(BlockNode start, BlockNode end, InsnNode insn) {
|
||||
EdgeInsnAttr edgeInsnAttr = new EdgeInsnAttr(start, end, insn);
|
||||
start.addAttr(AType.EDGE_INSN, edgeInsnAttr);
|
||||
end.addAttr(AType.EDGE_INSN, edgeInsnAttr);
|
||||
if (!start.getAll(AType.EDGE_INSN).contains(edgeInsnAttr)) {
|
||||
start.addAttr(AType.EDGE_INSN, edgeInsnAttr);
|
||||
}
|
||||
if (!end.getAll(AType.EDGE_INSN).contains(edgeInsnAttr)) {
|
||||
end.addAttr(AType.EDGE_INSN, edgeInsnAttr);
|
||||
}
|
||||
}
|
||||
|
||||
public EdgeInsnAttr(BlockNode start, BlockNode end, InsnNode insn) {
|
||||
@@ -41,6 +47,25 @@ public class EdgeInsnAttr implements IAttribute {
|
||||
return insn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
EdgeInsnAttr that = (EdgeInsnAttr) o;
|
||||
return start.equals(that.start)
|
||||
&& end.equals(that.end)
|
||||
&& insn.isDeepEquals(that.insn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(start, end, insn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "EDGE_INSN: " + start + "->" + end + ' ' + insn;
|
||||
|
||||
Reference in New Issue
Block a user