3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-15 10:26:16 +00:00

Proper idiomatic isEquals implementation.

This commit is contained in:
George Karpenkov 2016-01-06 10:24:00 +01:00
parent 92bb984305
commit 56db1867ef

View file

@ -49,17 +49,14 @@ public class Symbol extends Z3Object
return getKind() == Z3_symbol_kind.Z3_STRING_SYMBOL; return getKind() == Z3_symbol_kind.Z3_STRING_SYMBOL;
} }
@Override
public boolean equals(Object o) public boolean equals(Object o)
{ {
Symbol casted = null; if (o == null) return false;
try { if (o == this) return true;
casted = Symbol.class.cast(o); if (o.getClass() != this.getClass()) return false;
} Symbol other = (Symbol) o;
catch (ClassCastException e) { return this.getNativeObject() == other.getNativeObject();
return false;
}
return this.getNativeObject() == casted.getNativeObject();
} }
/** /**