diff --git a/dexlib/src/main/java/org/jf/dexlib/CodeItem.java b/dexlib/src/main/java/org/jf/dexlib/CodeItem.java index 7372ef3f..06ad5353 100644 --- a/dexlib/src/main/java/org/jf/dexlib/CodeItem.java +++ b/dexlib/src/main/java/org/jf/dexlib/CodeItem.java @@ -572,6 +572,39 @@ public class CodeItem extends Item { } } } + + @Override + public int hashCode() { + int hash = 0; + for (EncodedTypeAddrPair handler: handlers) { + hash = hash * 31 + handler.hashCode(); + } + hash = hash * 31 + catchAllHandlerAddress; + return hash; + } + + @Override + public boolean equals(Object o) { + if (this==o) { + return true; + } + if (o==null || !this.getClass().equals(o.getClass())) { + return false; + } + + EncodedCatchHandler other = (EncodedCatchHandler)o; + if (handlers.length != other.handlers.length || catchAllHandlerAddress != other.catchAllHandlerAddress) { + return false; + } + + for (int i=0; i { out.writeUnsignedLeb128(handlerAddress); } } + + @Override + public int hashCode() { + return exceptionType.hashCode() * 31 + handlerAddress; + } + + @Override + public boolean equals(Object o) { + if (this==o) { + return true; + } + if (o==null || !this.getClass().equals(o.getClass())) { + return false; + } + + EncodedTypeAddrPair other = (EncodedTypeAddrPair)o; + return exceptionType == other.exceptionType && handlerAddress == other.handlerAddress; + } } }