added hashCode

create canonifies simple ClassInterfacesTypes


git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1140 379699f6-c40d-0410-875b-85095c16579e
branch_1_1
jochen 26 years ago
parent 3ee902a629
commit 20700d69ba
  1. 12
      jode/jode/type/ClassInterfacesType.java

@ -78,6 +78,10 @@ public class ClassInterfacesType extends ReferenceType {
/* Make sure that every {java.lang.Object} equals tObject */ /* Make sure that every {java.lang.Object} equals tObject */
if (ifaces.length == 0 && clazz == null) if (ifaces.length == 0 && clazz == null)
return tObject; return tObject;
if (ifaces.length == 0)
return tClass(clazz);
if (ifaces.length == 1 && clazz == null)
return tClass(ifaces[0]);
return new ClassInterfacesType(clazz, ifaces); return new ClassInterfacesType(clazz, ifaces);
} }
@ -525,6 +529,14 @@ public class ClassInterfacesType extends ReferenceType {
return name+"_var"; return name+"_var";
} }
public int hashCode() {
int hash = clazz == null ? 0 : clazz.hashCode();
for (int i=0; i < ifaces.length; i++) {
hash ^= ifaces[i].hashCode();
}
return hash;
}
public boolean equals(Object o) { public boolean equals(Object o) {
if (o == this) if (o == this)
return true; return true;

Loading…
Cancel
Save