Added a hashCode and equals method, so that interning annotations that reference items works correctly

git-svn-id: https://smali.googlecode.com/svn/trunk@208 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
This commit is contained in:
JesusFreke@JesusFreke.com 2009-06-21 23:43:34 +00:00
parent 9f8be06898
commit 6ccb8b3d2b

View File

@ -121,4 +121,23 @@ public class EncodedIndexedItemReference<T extends IndexedItem<T>>
return valueType;
}
public int hashCode() {
if (item == null) {
return 0;
}
return item.hashCode();
}
public boolean equals(Object o) {
if (!(o instanceof EncodedIndexedItemReference)) {
return false;
}
EncodedIndexedItemReference other = (EncodedIndexedItemReference)o;
if (item != null) {
return item.equals(other.item);
} else {
return other.item == null;
}
}
}