QueryableDatatype.equals() is implemented based on the operator alone: if the operator in both objects is null, it returns true. It should compare the literalValue if operator is null.
DBInteger int1 = new DBInteger().
DBInteger int2 = new DBInteger().
int1.setValue(100);
int2.setValue(101);
int1.operator = a DBEqualsOperator
int1.operator.firstValue = a separate DBInteger with operator=null, and literalValue=(Long)100.
int2.operator = a separate DBEqualsOperator
int2.operator.firstValue = a separate DBInteger with operator=null, and literalValue=(Long)101.
When executing int1.equals(int2), this calls QueryableDatatype.equals(),
which calls equals() on the two DBEqualsOperators.
That in turn calls equals() on the two inner DBIntegers.
They both have operator=null, so returns true.
Instead, it should have compared the literalValues.
Not sure what should happen when one has operator and the other has only a literalValue.
Unit test nz.co.gregs.dbvolution.datatypes.DBIntegerTest.notEqualGivenDifferentLiteralValues() will reveal this.
Note: this bug will only become apparent once https://sourceforge.net/p/dbvolution/tickets/47 is resolved.
Anonymous
Diff:
Improved equals methods